howto create LFS livecd

Alexander E. Patrakov patrakov at ums.usu.ru
Tue Sep 25 01:15:22 PDT 2007


Lauri Kasanen wrote:

> can someone tell me how is the device mapper used in the lfs livecd?

device-mapper is used for pretending that the CD is fully read-write. 
This is done with the help of two loop devices.

/dev/loop0 is set on top of the root.ext2 file, /dev/loop1 is set on top 
of a huge (1.5 GB) but sparse (i.e., zeroed-out regions don't take 
space) file in /dev/shm. Then a "snapshot" device-mapper target is used 
to combine the two loops into a /dev/mapper/lfs-cd device that has 
initially the same content as root.ext2, but can be written to (changed 
sectors go to /dev/loop1, i.e. to tmpfs)

> I'm also interested in why was it chosen.

Another alternative is to use unionfs in order to pretend that the CD is 
fully RW. The 6.1.1 CD did this, but it was easy to cause a kernel oops 
or a full system hang. unionfs has been removed exactly because it was 
too buggy and unstable.

> At least on my older
> laptops it tends to cause some "block reading errors" that fill the
> screen, and then the system hangs. On the other hand, cloop-based
> livecd's work fine on these lappies too..

Cloop was never used on LFS LiveCDs. Older CDs used squashfs for 
compression, while modern CDs use zisofs. The change was done because, 
with device-mapper based RW mechanism, one has to compress a single file 
(root.ext2), not a full filesystem tree, and both zisofs and squashfs 
are equally efficient for that - but zisofs is simpler to set up.

BTW, this question is more suitable for the livecd at linuxfromscratch.org 
list. And please post the errors from the latest LFS LiveCD (r2052 or 
self-built from SVN trunk) - they are bugs.

-- 
Alexander E. Patrakov




More information about the blfs-support mailing list