Outmoding CDs (LiveCD)

John Richard Moser nigelenki at comcast.net
Wed Feb 15 17:46:16 GMT 2006


CDs are getting a little outmoded.  2GB USB drives cost about $170 on 
Newegg now, with 1GB available for $80-100.  We can stuff a whole live 
system into a 550MB CD, so we can probably work inside a gigabyte.

There should be an Ubuntu USB drive installer for Windows and Linux. 
Conceptually this would basically be a LiveCD with a slight modification 
to clone itself to a USB drive and install syslinux or Grub.  This 
should be entirely possible.

The LiveCDs to my understanding use a cloop or squashfs base system 
unionfs'd with a tmpfs.  Using the same concept, it should be possible 
to unionfs a squashfs / (squashfs is in mainline IIRC) with a JFS, XFS, 
or ReiserFS backing.  A separate /boot is mandatory here, likely ext2 or 
ext3 or at least JFS with a minimal (1 meg) journal.

The basic installation would be as follows:

  - Warn user that the selected USB drive will be -erased-
  - Allot one partition the size of the SquashFS image
  - Allot 50-100 MB for /boot
  - Allow the user to adjust the remainder between shared and the overlay
  - Partition the drive accordingly
  - Format file systems
  - Copy the SquashFS image onto the drive
  - Create an initrd
  - Install kernels to /boot
  - Install grub or syslinux to the USB drive

The resulting drive would appear as follows:


[VFAT...][SQUASHFS....][root overlay...............][swap...][/boot]

It would be possible also to separate /home from the overlay:

[VFAT...][SQUASHFS....][root overlay.][/home.......][swap...][/boot]

(Note:  NAND chips in USB drives should have about 3.0x10^18 or 
3.0x10^28 writes before they die, I forget which; plus they have 
built-in wear leveling.  Swap should not be a problem, just slow.  We 
COULD use a swap file instead of a partition.)

This has the particular advantage that grub can contain an entry that 
loads an initrd with the command line "reset_overlay" to reset the 
system.  The result would be that the initrd would load, load modules, 
and read its configuration files to set up {/ <-> OVERLAY}; but then 
instead of setting up the proper overlay on /, it would FORMAT the 
overlay, FORMAT /boot, copy /boot from the squashfs back to /boot, 
correct menu.lst, sync, and reset.

The result of this is that the system can be reset to its initial 
install state in about 15 seconds; however, the /home directory is 
isolated.  We may keep a copy of /etc/{passwd,group} (on boot at each 
shutdown or boot up) and parse for all users and groups >1000 <60000 
after the wipe as well, to make sure all user names and passwords are 
re-entered into the system properly.  A "Clear Passwords" option could 
clear the passwords, but this has its own security concerns (but anyone 
with physical access can do this anyway).


So the final result would be that the Ubuntu LiveCD could (from windows 
or linux) partition and format a 1GiB or larger USB drive and configure 
it to be a fully installed Ubuntu Linux system, with a few extra features.

The rapid reinstall feature could be tinkered with for base installs as 
a fast backup.  It may be possible to squashfs the union of {/ <-> 
OVERLAY} at user request and then reboot, destroy the two partitions (if 
they're adjacent) and resize, throw the new squashfs image in, and 
continue loading as normal.  This requires, of course, somewhere to PUT 
the new squashfs image in the meanwhile; but it would facilitate a hard 
snapshot of the system that could be instantly restored.  Separate / and 
/home are highly recommended in this setting, as /home may contain huge 
things like MP3 files and videos and sensitive documents that you may 
want to shred later.
-- 
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

     Creative brains are a valuable, limited resource. They shouldn't be
     wasted on re-inventing the wheel when there are so many fascinating
     new problems waiting out there.
                                                  -- Eric Steven Raymond

     We will enslave their women, eat their children and rape their
     cattle!
                                      -- Evil alien overlord from Blasto



More information about the ubuntu-devel mailing list