[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get the size of the loop-device?
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?
> I need this, so that I can create two loop-devices on top on it, like
> losetup -o 0 -s $halfsize /dev/loop6 /dev/loop5
> losetup -o $halfsize /dev/loop7 /dev/loop5
>
> I tried trivial `perl -e 'print -s "/dev/loop5"'`, but it just returns zero.
>
> There's likely a trivial answer to this, but I havn't been able to find it.
sectors=`blockdev --getsize /dev/loop5`
fullsize=`echo ${sectors}' * 512' | bc`
halfsize=`echo ${sectors}' * 256' | bc`
What are you trying to do?
--
Jari Ruusu 1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9 DB 1D EB E3 24 0E A9 DD
-
Linux-crypto: cryptography in and on the Linux system
Archive: http://mail.nl.linux.org/linux-crypto/