How-to: Persistence in Ubuntu Live Sessions

No, that doesn't mean keep trying to get Ubiquity to load; it's actually quite good these days, even if the 12.10 testing images are a bit, ahem, broken...

Rather, if you boot from a USB drive into Ubuntu as a Live Session (that is, not installed to the hard disk of a machine), you can opt to create a local storage area on that USB drive on which to store session information, additional applications, your profile and some data files.

Persistence is just a feature that the live session gives you when enabled during the creation of a bootable USB key using Startup Disk Creator or another tool such as Unetbootin. It creates a file which stores all the settings throughout the live session; files created, system log files and everything that will be normally remembered by a PC from session to session. Otherwise, at the next reboot, your live session everything will be lost.

Persistence practically gives you the ability to have your pocket Ubuntu, within the limits that a system running on a USB key has - capacity, performance, and an effective limit of the number of read-writes of the device.

When you create the USB key, you can open it in Nautilus file manager and find a file named casper-rw, that is the persistence file.

Besides a copy of Ubuntu-in-your-pocket, it is a useful testing platform, because it stores all the log files, keeping track of bugs, so if your session crashes or freezes, you can reboot and see what caused the problem, all without screwing up any installed software on the host PC.

Creating Bootable USB flash drives
A guide can be found on the Ubuntu community help site. For the basics:

  • Ubuntu Desktop or server requires a 1GB USB flash drive (the Ubuntu site recommends 2GB).
  • Check the USB flash drive for files and back them up if needed. Putting the Ubuntu system files on the USB flash drive and making it bootable will destroy all pre-existing files on the USB flash drive!
  • The Windows utility won't let you select the USB flash drive if the drive isn't properly formatted and mounted.
To start Ubuntu from the USB flash drive, it needs the Ubuntu system files from the CD-ROM image, and it must be be configured to start up, or "boot", your computer. There are many guides for doing this on the web, but the easiest way to do the whole thing is to run the Ubuntu usb-creator program. Versions of this are available for Ubuntu and for Windows.

Booting the Computer from USB
  • Remove all unneeded USB items, but keep the network cable attached.
  • Insert the bootable USB flash drive that you just created in your target computer and restart it. Most newer computers can boot from a USB flash drive. If your computer does not automatically do so, you might need to edit the BIOS settings:
  • Restart your computer, and watch for a message telling you which key to press to enter the BIOS setup. It will usually be one of F1, F2, DEL, ESC or F10. Press this key while your computer is booting to edit your BIOS settings. (On HP Mini Netbooks, they correct key is usually F9.)
  • You may need to edit the Boot Order. Depending on your computer, and how your USB key was formatted, you should see an entry for "removable drive" or "USB media". Move this to the top of the list to make the computer attempts to boot from the USB device before booting from the hard disk.
  • Instead of editing BIOS settings, you can chose a boot device from the boot menu. Press the function key to enter the boot menu when your computer is booting. Typically, the boot screen displays which key you need to press. It maybe one of F12, F10. Note: with some motherboards you have to select 'hard disk/USB-HDD0' to choose the USB flash disk.
That should be enough to get you going. Further guides to Startup Disk Creator can be found under How to create a bootable USB stick on Ubuntu. RC