I have Ubuntu 13.10 and I am running live image as making an entry in grub as per the tutorial: http://www.tecmint.com/run-linux-live-images-from-hard-disk-in-linux. So is there any way to make the changes persist? I want to save few changes like my wireless drivers, so if I am able to do so, it would save me from installing drivers every time I boot.
Setting Up Your USB Stick
Setting up a device for use as Live CD persistent storage device is fairly simple. We just partition it and format it while giving it a special name that the Live CD recognizes. Although you can use any device visible to the CD for persistent storage, in this example we will discuss using a USB stick since they are pretty common now and are relatively inexpensive. There are no minimum size requirements for your storage device, but naturally, the more storage space you have the more applications you can install and settings you can save.
Plug your USB Stick into your computer and let's get it ready for Live CD persistence.
Note: If you previously followed the instructions on this page for "casper-cow" and it didn't work, that's because it should have read "casper-rw".
Note 2: In the instructions below the ext3 file-system is used. For a memory stick however where space is tight, the ext2 file-system will use up considerably less overhead and is probably good enough for this purpose.
Note 3: The instructions use all terminal commands, many of them looking quite serious. However it can all be done using the graphical Gnome Partition Editor tool you find in the System -> Administration menu. The exception is giving the partition a label, for this you'd still need to go to a terminal and issue the command
Determine Which Device Your USB Stick Is
Note: if you prefer, you can use GPartEd to identify and format the usb thumb drive to ext3 (or a different compatible format) and then skip directly to the "Creating the "casper-rw" File System" section.
In order to partition and format your USB Stick, we first need to determine which device your computer recognizes it as and what its mount point is. To find this information run the following command:
The output of df -h should look something like this:
As you can see, on my computer, my USB Stick is the last entry in the list and is seen as /dev/sda1 and is mounted and accessible at /media/USB DISK. Now that we know where our USB Stick is, let's go ahead and partition it properly.
Partitioning Your USB Stick
Partitioning your USB Stick is a fairly simple task and only requires a few short steps. To partition your USB Stick we will use the command fdisk so run the following command to start the process (replacing /dev/sda with your device path):
Without getting in depth about how to use fdisk (which is outside the scope of this document) here is how you can partition your USB by deleting any existing partitions and creating one new partition.
First type “p” at the command prompt and hit to print the current partition table. The output of this command should look something like this:
Again, for this example, we will just delete all of the existing partitions so now type “d” at the command prompt. Then enter the number of the partition you wish to delete. Repeat this process for each partition on your USB Stick until they are all deleted. The following is a example of what your session might look like:
Command (m for help):
As you can see we have now deleted all of the partitions on our USB Stick. Now we can create one new partition by typing “n” at the command prompt followed by your desired partition number. Once that is done type “w” and hit to write the partition table changes to your USB Stick. Here is the output from my session:
Now that we have our partition table all set let's format it.
Creating the "casper-rw" File System
Formatting your USB Stick is also a very simple task. First we will unmount the device so we can format it, then just format it.
First unmount your USB Stick by running the following command:
Now that your USB Stick is unmounted we can format it. The only special consideration is that we must give the formatted partition the label “casper-rw”. This is the name the Live CD looks for to store persistent information. You can properly format your USB Stick by issuing the following command:
The output of this command should look something like this:
NOTE: This example uses the ext3 file system, but almost any file system should work. Among the file systems which won't work are VFAT and NTFS
Now that we have our partition created and formatted all that is left to do is use it. So let's go use it!
__Using a Loopback File__
Instead of using a USB stick, you can use a file on your hard disk to store persistent information. The file must be named casper-rw and must be on the root of a partition. This partition can be any type that can be mounted automatically (e.g. vfat or ext3). (The persistent mode still works, if the file is created on the root partition of an USB stick.)
The following commands assume that a partition is mounted at /media/hda1. You can use any partition; even / will do fine. A file 128 MB in size will be created on this partition. To change the size, modify the count parameter of the "dd" command.
That's it! You can now boot the Live CD as described below.
Booting the Live CD in Persistent Mode
Now we get to enjoy the fruits of our labor. Make sure your USB Stick is plugged into your computer and take the Live CD that you downloaded and burned earlier and put it in your CD drive (if it is not already there). Reboot your computer and boot up using this Live CD.
Before you reboot there are only two things that you need to remember. When the Live CD menu gets displayed hit the key to enter “Other Options”. This will display the arguments that the Live CD passes to the kernel. At the end of this argument list just add a space and add the word “persistent”. This will instruct the Live CD to maintain and use persistence. That is all. Go for it!
Note: It appears that with Flight 5, you need to create a new user in the Live CD session (go System -> Administration -> Users + Groups, then press the "Add User" button) for it to save your settings; it does not appear to save most changes to the default user, "ubuntu". When you create the new user, be sure to check the box in the "user privileges" tab that says "executing system administration tasks" or you'll be pretty limited in what you can do Smile :)
When you get back, or better yet, when you boot into your live environment come back to this page and see how you perform a few basic tests to make sure everything is working correctly.
Verifying That Everything Worked
Here are a few simple things you can do to verify that everything is working as expected.
Reboot the Live CD/USB
The first simple thing you can do to verify that persistence is working is install a few applications and change some environment settings (some thing highly visible and easily recognizable) like your theme or add some GNOME panel icons. Then just reboot... Hit , enter in “persistent” on the kernel arguments list and boot into your new custom Live CD environment. Your newly installed applications and your custom settings should all still be there.
If you want to dig a little deeper you could always inspect the contents of your USB Stick. This will also give you deeper insight into how this great system works.
(you can do this from the Live CD by going System -> Administration -> Disks, selecting the appropriate drive, setting the access path to /mnt and pressing the Enable button followed by the Browse button)
Investigating What Is Now On Your "casper-rw"
Another relatively simple thing you can do to verify that everything is working and to learn more about how everything works is to just inspect what is now on your USB Stick in isolation. Reboot back into your regularly installed system, plug in your USB Stick and just have a look around. The contents of your USB Stick is what makes your custom environment your own.
By using reconstructor a CD can be remastered and an additional menu item (Persistent Mode) added on boot. The persistent mode was added as the default. No changes were made to the CD except for adding the persistent menu item. This may be best described in another how-to. If there is a place where a persistent ISO can be uploaded I'd be glad to share
The new Ubuntu Live CD persistence is an excellent capability and in addition to current Live CD uses, this will certainly make Live CDs very much more viable, useful and important. Now you can carry around your own custom Ubuntu environment on a CD and USB Stick that all just fits in your pocket. Now go gloat to your friends and co-workers about how much Ubuntu ROCKS!
If you encounter the problem of booting without persistence on on UEFI pc. See what Ubfan (ubfan1) wrote on 2013-04-29 here: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1159016
Create a file named casper-rw with ext3 file system in root directory of a partition with FAT32 file system.
Create a partition with ext3 filesystem and label casper-rw
Then edit the grub menu and add option persistent. For example
It's OK to use existing partition with above specification in a HDD or USB or any writeable storage. I recommend HDD as using slower USB devices will lead to reduced speed of OS. Storing casper-rw file in other file system like EXT2/EXT3/NTFS/exFAT seems not working. (Does anyone has success ? I'm very happy to hear that. )
Let us arrogantly suppose that someone gives up to make a different FAT32 or ext2 partition just to place "cheap" combo of iso and extra partition for sake of this persistence magic. Well, it's also good idea to enable
To do this you can act in either