LiveCD internals

You may want to inspect the contents of a Live CD.

Most Linux distributions provide the contents of a "boot" CD as an ISO image with the extension .iso files. The file includes all the information to make an exact copy of the original CD, including boot sectors and disk label.

Inspecting .iso contents
After you have downloaded the .iso, you can mount it as a loopback filesystem to view its contents instead of burning it to a CD.

One way to do this is using the UNIX mount command in a terminal. You will need to be root or use sudo to run the command: cd ~ mkdir tempwork cd tempwork mkdir isotemp sudo mount -o loop path/to/downloaded.iso isotemp

Now you can look at the contents of the .iso in the directory isotemp

initrd contents
The boot process loads a Linux kernel loads into memory, but this needs many additional loadable kernel modules and other files such as splash screen images to complete booting. One way to provide these supporting files is to load these into an in-memory filesystem that the Linux boot sequence mounts before the real file system is available.

The live CD usually has an initrd ("initial RAM disk") or initramfs that has the files intended for the RAM disk in compressed form. In an Ubuntu Live CD, a file named initrd.lz and the compressed kernel image vmlinuz are in the casper directory. The initrd.lz file is a cpio archive of a directory that has been compressed using lzma, thus to restore it to a temporary directory: mkdir lztempdir cd lztempdir lzma -dc -S .lz ../isotemp/casper/initrd.lz | cpio -imvd --no-absolute-filenames cd ..

This puts the contents of initrd.lz in the directory lztempdir for inspection.

squashfs contents
Similarly, the rest of the contents of the live CD are usually shipped compressed, for example using the SquashFS filesystem format. You can also mount this as a loopback filesystem. mkdir squashtemp sudo mount -o loop isotemp/casper/filesystem.squashfs squashtemp

Now you can look at the contents of the squashfs filesystem in the directory squashtemp.

Cleaning up
The two mounts just accessed the filesystems within the .iso file, but the .lz file contents were extracted and so have to be removed.

sudo umount squashtemp rm -r lztempdir sudo umount isotemp rmdir isotemp squashtemp cd .. rmdir tempwork and you can remove the .iso file you downloaded if you have no more use for it