Shared publicly  - 
 
Linux 3.2 finally allows partitioning of loop devices so we don't have to play ugly and unreliable games in user-space using e.g. kpartx(8) to set up linear targets for each partition.

In particular, this allows us to avoid the overly complex device-mapper "rules" which include respecting e.g. DM_UDEV_DISABLE_OTHER_RULES_FLAG to avoid "upsetting" the dm user-space tools. This is a good thing because the way device-mapper integrates with udev has so far been extremely unreliable. Maybe some day the device-mapper stuff will work with the rest of the OS (e.g. with stuff such as +udev), who knows, until then it's better to keep it simple and just bypass it altogether if we can. Hence, just make the kernel partition the loop device - much simpler, and thus, much better.

Why is this new feature useful? Well, for example, suppose you want to image an entire disk, using e.g. "dd if=/dev/sdb of=MyDisk.img". When attaching the image, you will now get devices for both the whole "disk" (/dev/loop0) and for each partition (/dev/loop0p1, /dev/loop0p2 and so on). In particular, all the usual tools, command line and GUI, will work on it just if it was a regular disk. I've attached a screenshot of GNOME's Disk Utility as an example (if you think the Disk Utility looks different from the one shipped in GNOME 3.2 you are correct - it's been rewritten).

Thanks +Kay Sievers and +Jens Axboe!

Edited: Here's a link to the screenshot - for some reason, the photo I've uploaded is really small: http://people.freedesktop.org/~david/gdu2-loop-partitions.png
21
David Woodhouse's profile photo
Add a comment...