Partitioned loopback devices
Carl-Daniel Hailfinger has recently posted an interesting solution to the partition limit: partitioned loopback devices. A loopback device is a kernel-implemented virtual block device which is backed up by something real - usually a disk partition or a file on a disk somewhere. Common uses for loopback devices include mounting regular files as filesystems or the creation of encrypted filesystems (though the device mapper is the preferred means for the latter application in 2.6). Loopback devices do not support partitions in their own right; they simply provide block-level access to the backing store as a single partition.
Carl-Daniel noticed, however, that adding partition support to loopback devices would be a relatively straightforward thing to do. In 2.6, partition handing is (finally) part of the block layer; all that is really required to support partitions in the loopback driver is to tell the block layer that those partitions exist. So, with a small patch, each loopback device can have up to 127 partitions. The bulk of the patch, in fact, is there to ensure continued compatibility for users of non-partitioned loopback devices.
This capability is interesting because it is a simple matter of one
losetup command to create a loopback interface to a real disk
drive. Thus, by using loopback devices in this mode, system administrators can
get around the partition limits enforced by the real hardware drivers and
divide their disks into lots of tiny little pieces. There is some small
overhead associated with using the loopback device, but, for users
in need of more partitions, it may well be a price worth
paying.
| Index entries for this article | |
|---|---|
| Kernel | Block layer/Loopback device |
| Kernel | Loopback device |
| Kernel | Partitions |
