Sunday, June 21, 2009

Linux commands I read about today

The losetup command is for managing loop devices. The loop device driver accesses regular files instead of physical devices. But, while they are block devices, you can't partition them like real block devices (i.e. disks). You can run fdisk but will have to tell it the number of cylinders, after which it will create a partition table for you, but there will be no devices created to access those partitions and attempt to reload the partition table (as fdisk does after writing it or with blockdev --rereadpt) fails with Invalid argument. This email may be relevant and this post has some further examples.

The blockdev command is for calling select ioctl commands on block devices from the command line.

The tc command can be used to add latency to loop devices (and lots else):

tc qdisc add dev lo root handle 1:0 netem delay 20msec

tc qdisc del dev lo root

the loop device can be used to access partitions in disk images.

Note that the NASA enhanced loop device is still available from ftp://ftp.hq.nasa.gov/pub/ig/ccd/enhanced_loopback/ but it is patches against a 2.4 kernel and has not been updated since 2004.

No comments:

Labels