[Read This Fine Material] from Joshua Hoblitt

Insepecting Gentoo livecd builds with Linux loopback devices


I’ve recently been building a number of custom Gentoo liveCDs and wanted to be able to inspect the results of the build without having to boot them on a machine. The “running”system image on a livecd is stored as a squashfs image that gets unpacked during the boot process. So in order to view the true system image you need to setup a loopback device both for .iso image and the squashfs image which is contained in the cd image.

Here is an example of mounting a livecd image

losetup /dev/loop0 /var/tmp/catalyst/builds/default/install-amd64-minimal-2007.0-serial.iso
mount /dev/loop0 /mnt/tmp
losetup /dev/loop1 /mnt/tmp/image.squashfs
mount /dev/loop1 /mnt/tmp1

And conversely, you need to unmount the loop back devices in the proper order.

umount /mnt/tmp1
losetup -d /dev/loop1
umount /mnt/tmp
losetup -d /dev/loop0

Leave a Reply