Take your desktop with you on a USB stick and access it anywhere with the Ubuntu Live CD.
Wouldn't it be handy if you could walk up to any random computer, insert a copy of the Ubuntu Live CD, plug in a USB key, boot it up, and have a fully working system with your own documents, settings, and programs—without modifying the computer in any way?
A little-known feature of the Ubuntu Dapper Drake Live CD allows you to do exactly that. When it starts up, it searches for a volume that has been given the label casper-cow and uses it to store documents, themes, and even extra programs that you install. This is far more powerful than just booting up a live CD and mounting a memory stick as your home directory because it's not restricted to just storing your documents. It gives you the flexibility of a fully installed system, while retaining the "go anywhere" feature of a live CD.
You can perform this trick with just about any storage device, including removable USB hard disks and compact flash drives, but for this hack we use a USB memory stick because they're cheap, portable, and commonly available in increasingly large capacities.
Connect the USB memory stick to a computer running Ubuntu. Ubuntu will probably mount it automatically, so the first thing to do is to find the device name that it has been assigned. Open Applications→Accessories→Terminal and type the following at the shell prompt:
to see a list of mounted volumes. The output should look something like this:
Filesystem Size Used Avail Use% Mounted on /dev/hda3 54G 19G 35G 36% / varrun 506M 84K 506M 1% /var/run varlock 506M 0 506M 0% /var/lock udev 506M 116K 506M 1% /dev devshm 506M 0 506M 0% /dev/shm /dev/hda1 221M 28M 181M 14% /boot /dev/sda1 498M 214M 285M 43% /media/usbdisk
USB storage devices are emulated as SCSI devices by Linux, and you can see the last device is listed as /dev/sda1. This means SCSI device A, partition 1. If you have anything on the memory stick that you want to save, now is the time to copy it onto your computer, because you're about to totally erase it.
Once you've backed up your files, it's time to unmount the device:
Ubuntu is smart enough to figure out if you are "in" the device (either on the command line or using the file browser), so if the system refuses to unmount because the device is still in use, just close any other windows you have open and try again.
Then create a new filesystem with the correct label:
sudo mkfs.ext3 -b 4096 -L casper-cow
You must replace
/dev/sda1 with the
actual device name used by your memory stick. If you have other USB
devices attached, it is possible that one of them has claimed this
device name. If in doubt, run the command dmesg
right after you plug in the memory stick. You should see a message
indicating the name of the device that was used to represent your
This will create an ext3 journaling filesystem, which is a good choice for general-purpose use, but, if you prefer, you can use any filesystem that's supported by the Live CD. The mkfs.ext3 command will report some statistics about the new filesystem, and then you're ready to try it out.
Plug your USB memory stick into the target machine, power up the computer, and quickly insert the Dapper Drake Live CD. If the computer is not configured to boot from CD-ROM, you may need to press a key (typically Del or F2) at startup to enter the BIOS settings menu; you then need to change the order of the boot devices to put CD-ROM at the top of the list, and then select the Exit option (the one that saves your changes to the BIOS) from the BIOS menu. The computer will then boot up again and look for the Live CD before attempting to boot from the hard disk. Some computers have a menu (often activated by F12) that lets you choose which device to boot from without having to make changes to your BIOS.
If you are using a Mac, you need to hold down the C key to boot from a CD.
When the Live CD starts up, you will see a menu. Normally, you
would just press Enter to start the boot process, but instead, press
F4 to access the Other Options menu that allows you to start up the
Live CD in special modes. You'll see a list of the arguments that will
be passed to the kernel on startup; just add a space and type
persistent, then hit Enter.
The computer will now boot from the Live CD in persistent mode, but you won't see anything different. In fact, it can be quite hard to tell if it even worked or not. As a simple test, you can try changing something obvious, such as your desktop picture, and then you can log out and reboot the computer back into persistent mode. If everything worked properly, your desktop picture will still be set as you specified.
Try changing other things on your system such as creating documents or even installing extra software. Changes you make should be preserved even after you reboot the system.
The Live CD is a read-only environment, so of course you can't save changes made to the running system straight to the CD. However, when running in persistent mode, the system on the Live CD allows items on your memory stick to override items within the Live CD environment. In the test described in this hack, you changed the desktop image; this caused Ubuntu to save your new desktop picture and settings onto the casper-cow device. The next time the Live CD sets the desktop, it detects that a new setting has been stored on the device and applies it instead of the default setting. The Live CD therefore provides the basic data for a complete, functional environment, and any changes you make to that environment are written to the removable device and used to override the default settings.