On 2/1/06, Jari Ruusu <jariruusu@xxxxxxxxxxxxxxxxxxxxx> wrote: > Markus Laire wrote: > > Once I have a working loop device, e.g. /dev/loop5, how can I get the > > size of this device in bytes for bash-script? > > sectors=`blockdev --getsize /dev/loop5` > fullsize=`echo ${sectors}' * 512' | bc` > halfsize=`echo ${sectors}' * 256' | bc` > > What are you trying to do? I'm writing a script which double-encrypts a single swap-area and /tmp with random keys. If I simply use two loop-devices for both, I need 4 sets of random keys. So I'm trying this setup which only needs 2 sets of random keys: (I don't want to waste the entropy) (Note: I intend to use 2 different ciphers, but currently I only have AES working) losetup -e AES256 -H random /dev/loop7 "$DEV" losetup -e AES256 -H random /dev/loop6 /dev/loop7 losetup -s $halfsize /dev/loop4 /dev/loop6 losetup -o $halfsize /dev/loop5 /dev/loop6 mkswap /dev/loop4 > /dev/null mke2fs -m 0 /dev/loop5 &> /dev/null swapon /dev/loop4 mount -t ext2 /dev/loop5 /tmp chmod 1777 /tmp -- Markus Laire - Linux-crypto: cryptography in and on the Linux system Archive: http://mail.nl.linux.org/linux-crypto/