特殊:Badtitle/NS100:LiveCD/Persistence:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/LiveCD/Persistence}} {{Languages|UbuntuHelp:LiveCD/Persistence}} == Introduction == Live CDs are often used for trying out new software, demos, an... |
小无编辑摘要 |
||
(未显示同一用户的4个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/LiveCD/Persistence}} | {{From|https://help.ubuntu.com/community/LiveCD/Persistence}} | ||
{{Languages|UbuntuHelp:LiveCD/Persistence}} | {{Languages|UbuntuHelp:LiveCD/Persistence}} | ||
This page explains how to enhance a read-only [[UbuntuHelp:LiveCD|LiveCD]] by adding persistent file storage on another drive. | |||
In more recent Ubuntu versions, you can instead use the usb-creator tool to create a bootable USB flash drive from a Live CD, and its user interface has an option to add persistent storage on the same USB drive; see [[UbuntuHelp:Installation/FromUSBStick|Installation/FromUSBStick]]. | |||
== Introduction == | == Introduction == | ||
Live | [[UbuntuHelp:Live CD|Live CD]]s and !LiveUsbs provide a highly portable, secure, dependable and familiar environment that is easy to use on almost any machine. | ||
However, [[UbuntuHelp:LiveCd|LiveCd]] sessions become even more useful when a '''persistent image''' can retain data and settings (even installed programs and packages) when the machine gets switched off. All the data can be easily pocketed and kept safe, perhaps to be physically carried to another machine. | |||
The advantages over Cloud Computing are; that it does not require a working internet connection, it gives better privacy and security as it does not place your data in other peoples possession. | |||
A persistent image will need to be kept on a Usb-stick or external hard-drive to really maximise on the usefulness of the [[UbuntuHelp:LiveCd|LiveCd]] session so that is what this guide describes. It would also be possible to keep the image on a local hard-drive or any device the CD can see attached to the computer. Please keep it backed-up elsewhere too. The main usefulness would seem to be from using a Usb-stick. | |||
Note that programs and packages may take up a high percentage of the valuable space so it might be worth considering creating a [[UbuntuHelp:LiveCDCustomizationFromScratch|| Customised CD]] or [[UbuntuHelp:LiveCDCustomization|| Remix]] every once in a while, updating with packages you have installed in the persistent image since making the last Remix. | |||
== Getting the Live CD == | == Getting the Live CD == | ||
Live CD persistence is a feature of the Ubuntu 6.06 LTS "Dapper Drake" release. You can download the latest version of the Live CD here: | Live CD persistence is a feature of the Ubuntu 6.06 LTS "Dapper Drake" release. You can download the latest version of the Live CD here: | ||
http://releases.ubuntu.com/ | http://cdimage.ubuntu.com/releases/dapper/release.1/ | ||
update for Lucid | |||
http://cdimage.ubuntu.com/daily-live/current/ | |||
to save yourself a cd, simply save then mount the .iso file; | |||
to customize the packages etcetera contained in the Live cd, see [[UbuntuHelp:LiveCDCustomization|LiveCDCustomization]] | |||
=== Versions Tested === | === Versions Tested === | ||
Works | * 8.10 "Intrepid Ibex" - Works, use "usb-creator" tool to automate process after creation of the partitions; automatic syslinux.cfg may be more workable than the syslinux.cfg listed here; automatic syslinux.cfg however contains no reference to a persistent boot | ||
* 8.04 "Hardy Heron" - [https://bugs.launchpad.net/ubuntu/+source/casper/+bug/219192 Doesn't work] | |||
[https://bugs.launchpad.net/ubuntu/+source/casper/+bug/ | * 7.10 "Gutsy Gibbon" - Works on official release | ||
* 7.10 "Gutsy Gibbon" Tribe 1 release - Doesn't work (more information below) | |||
* 7.04 "Feisty Fawn" [https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591 Doesn't work] | |||
* 6.10 "Edgy Eft" - Works | |||
[https://bugs.launchpad.net/ubuntu/+source/casper/+bug/ | * 6.06 LTS "Dapper Drake" - Works | ||
== Setting Up Your USB Stick == | == 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. | 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. | 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"; please see changes below as per [http://ubuntuforums.org/showthread.php?t=143729 this thread] | '''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"; please see changes below as per [http://ubuntuforums.org/showthread.php?t=143729 this thread] | ||
'''Note 2:''' In the instructions below the ext3 | '''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 do a # sudo e2label /dev/<yourpartition> casper-rw | '''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 do a # sudo e2label /dev/<yourpartition> casper-rw | ||
=== Determine Which Device Your USB Stick Is === | === Determine Which Device Your USB Stick Is === | ||
'''Note:''' if you prefer, you can use | '''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: | 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: | ||
<pre><nowiki> | <pre><nowiki> | ||
第138行: | 第147行: | ||
Now that we have our partition created and formatted all that is left to do is use it. So let's go use it! | 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 == | == 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). | 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. | 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. | ||
<pre><nowiki> | <pre><nowiki> | ||
第171行: | 第180行: | ||
180 days, whichever comes first. Use tune2fs -c or -i to override. | 180 days, whichever comes first. Use tune2fs -c or -i to override. | ||
</nowiki></pre> | </nowiki></pre> | ||
That's it! You can now boot the Live CD as described below. | That's it! You can now boot the [[UbuntuHelp:LiveCD|| Live CD]] as described below. | ||
== Booting the Live CD in Persistent Mode == | == 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. | 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. | ||
第188行: | 第197行: | ||
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 | 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 | ||
== Gutsy Gibbon Notes == | == Gutsy Gibbon Notes == | ||
It is currently unknown what is the problem with [[UbuntuHelp:LiveCDPersistence|LiveCDPersistence]] and Gutsy Tribe 1 | It is currently unknown what is the problem with [[UbuntuHelp:LiveCDPersistence|LiveCDPersistence]] and Gutsy Tribe 1. By reading the persistence problems with Feisty, I have guessed that Casper is at fault. | ||
'''2007-10-04''' - Gutsy beta 1 2007-09-28 - '''SUCCESS''' | '''2007-10-04''' - Gutsy beta 1 2007-09-28 - '''SUCCESS''' | ||
I can report success using the Gutsy beta (2007-09-28) and persisting to a USB stick using the above steps (grub option "persistent" at boot, "casper-rw" label on ext3 fs USB stick partition). My home directory, bookmarks, preferences etc. are persisting between | I can report success using the Gutsy beta (2007-09-28) and persisting to a USB stick using the above steps (grub option "persistent" at boot, "casper-rw" label on ext3 fs USB stick partition). My home directory, bookmarks, preferences etc. are persisting between Live CD boots. This is using a Thinkpad X60s -- Alastair | ||
== Conclusion == | == Conclusion == | ||
The new Ubuntu Live CD persistence is an excellent | 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! | ||
== Outstanding Questions == | == Outstanding Questions == | ||
* What is the min. USB key size that is needed? How about adding a swap partition to the USB key? | * What is the min. USB key size that is needed? How about adding a swap partition to the USB key? | ||
* Wouldn't the Live CD rock more if the end-user didn't have to fudge around with kernel arguments and the Live CD just did what was right, to wit: if there is a removable media device labelled "casper-rw" and formatted appropriately, use it (or at least ask) and if there isn't, don't? | * Wouldn't the Live CD rock more if the end-user didn't have to fudge around with kernel arguments and the Live CD just did what was right, to wit: if there is a removable media device labelled "casper-rw" and formatted appropriately, use it (or at least ask) and if there isn't, don't? See either of these 2 guides | ||
* https://help.ubuntu.com/community/[[UbuntuHelp:LiveCD|LiveCD]]CustomizationFromScratch | |||
* https://help.ubuntu.com/community/[[UbuntuHelp:LiveCD|LiveCD]]Customization | |||
* Wouldn't it rock still further if the instructions provided were done up as a quick'n'dirty GUI (Knoppix-style) which allowed an end-user to make their persistent store without having to fudge around with the CLI at all? | * Wouldn't it rock still further if the instructions provided were done up as a quick'n'dirty GUI (Knoppix-style) which allowed an end-user to make their persistent store without having to fudge around with the CLI at all? | ||
* Is there a way to use a (luks)encrypted usb stick? | * Is there a way to use a (luks)encrypted usb stick? | ||
* Every single disk write goes to the USB stick, which GNOME loves to do all the time. After following these directions, I booted the [[UbuntuHelp:LiveCD|LiveCD]] using the "persistent" boot option. All I did was change the desktop background to a solid color and visit Slashdot's front page in Firefox. Then I powered down the system and looked at how much written data was saved on the USB stick. 75 MB! Most was gnome-related stuff under /var/lib. Ouch. And the USB stick got written to the whole time pretty much. Won't that wear out the USB stick much faster? Can't the changes be dumped in bulk only once in a while, when the user presses a button on some applet? And only that data that is in the user's home directory? This will keep the USB stick from wearing out. [http://slax.linux-live.org/ SLAX] has got scripts to do this already that could perhaps be copied. Especially see the SLAX script called "configsave". | * Every single disk write goes to the USB stick, which GNOME loves to do all the time. After following these directions, I booted the [[UbuntuHelp:LiveCD|LiveCD]] using the "persistent" boot option. All I did was change the desktop background to a solid color and visit Slashdot's front page in Firefox. Then I powered down the system and looked at how much written data was saved on the USB stick. 75 MB! Most was gnome-related stuff under /var/lib. Ouch. And the USB stick got written to the whole time pretty much. Won't that wear out the USB stick much faster? Can't the changes be dumped in bulk only once in a while, when the user presses a button on some applet? And only that data that is in the user's home directory? This will keep the USB stick from wearing out. [http://slax.linux-live.org/ SLAX] has got scripts to do this already that could perhaps be copied. Especially see the SLAX script called "configsave". | ||
* How can the USB stick be set up to have everything included? There's no reason for a 700 MB CD if the USB disk has a couple of GB's today. Would this be an entire ubuntu installation on the USB disk?. For this, one can use Ubuntu Live CD installation icon on the desktop. | * How can the USB stick be set up to have everything included? There's no reason for a 700 MB CD if the USB disk has a couple of GB's today. Would this be an entire ubuntu installation on the USB disk?. For this, one can use Ubuntu Live CD installation icon on the desktop. | ||
Keep in mind that not everybody we want to convert to Ubuntu is a power user (administrator). I can pretty much guarantee that anything that looks like typing Scary Strings is going to turn people off, not on, no matter how "powerful" it is behind the scenes. | Keep in mind that not everybody we want to convert to Ubuntu is a power user (administrator). I can pretty much guarantee that anything that looks like typing Scary Strings is going to turn people off, not on, no matter how "powerful" it is behind the scenes. | ||
This feature (and the whole Ubuntu Live CD release) rocks, and I agree that it would rock even more if one could do it without CLI commands. It seems there is only a small number of places where the persistence can be stored (USB key and loopback file). The ideal solution would therefore seem to be an option at startup to create persistence in the one or few places where it is possible (including the hard drive), and the default option would look for persistence file and allow a choice if more than one is found (I wonder how is that dealt with currently?). This is option is absolutely ideal for people stuck with corporate computers, that want to start moving towards Linux, but are afraid to mess with their partitions just yet. | This feature (and the whole Ubuntu Live CD release) rocks, and I agree that it would rock even more if one could do it without CLI commands. It seems there is only a small number of places where the persistence can be stored (USB key and loopback file). The ideal solution would therefore seem to be an option at startup to create persistence in the one or few places where it is possible (including the hard drive), and the default option would look for persistence file and allow a choice if more than one is found (I wonder how is that dealt with currently?). This is option is absolutely ideal for people stuck with corporate computers, that want to start moving towards Linux, but are afraid to mess with their partitions just yet. | ||
Suggestion: Actually very little CLI commands are needed, as nearly all of it can be done using the Gnome Partition Editor which is in the Administration menu. However it does not have an option for setting the disk label. In the 'Device' menu there's a 'Set Disk Label' item, however that's not it. :) This wiki page should probably be redone using the Gnome Partition Editor tool, and loads of screen shots. | Suggestion: Actually very little CLI commands are needed, as nearly all of it can be done using the Gnome Partition Editor which is in the Administration menu. However it does not have an option for setting the disk label. In the 'Device' menu there's a 'Set Disk Label' item, however that's not it. :) This wiki page should probably be redone using the Gnome Partition Editor tool, and loads of screen shots. | ||
== External Links == | |||
https://wiki.ubuntu.com/LiveUsbPendrivePersistent | |||
---- | ---- | ||
[[category:CategoryLive]] | [[category:CategoryLive]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 23:09的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/LiveCD/Persistence }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/af | • {{#if: UbuntuHelp:LiveCD/Persistence|Afrikaans| [[::LiveCD/Persistence/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ar | • {{#if: UbuntuHelp:LiveCD/Persistence|العربية| [[::LiveCD/Persistence/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/az | • {{#if: UbuntuHelp:LiveCD/Persistence|azərbaycanca| [[::LiveCD/Persistence/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/bcc | • {{#if: UbuntuHelp:LiveCD/Persistence|جهلسری بلوچی| [[::LiveCD/Persistence/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/bg | • {{#if: UbuntuHelp:LiveCD/Persistence|български| [[::LiveCD/Persistence/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/br | • {{#if: UbuntuHelp:LiveCD/Persistence|brezhoneg| [[::LiveCD/Persistence/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ca | • {{#if: UbuntuHelp:LiveCD/Persistence|català| [[::LiveCD/Persistence/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/cs | • {{#if: UbuntuHelp:LiveCD/Persistence|čeština| [[::LiveCD/Persistence/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/de | • {{#if: UbuntuHelp:LiveCD/Persistence|Deutsch| [[::LiveCD/Persistence/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/el | • {{#if: UbuntuHelp:LiveCD/Persistence|Ελληνικά| [[::LiveCD/Persistence/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/es | • {{#if: UbuntuHelp:LiveCD/Persistence|español| [[::LiveCD/Persistence/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/fa | • {{#if: UbuntuHelp:LiveCD/Persistence|فارسی| [[::LiveCD/Persistence/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/fi | • {{#if: UbuntuHelp:LiveCD/Persistence|suomi| [[::LiveCD/Persistence/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/fr | • {{#if: UbuntuHelp:LiveCD/Persistence|français| [[::LiveCD/Persistence/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/gu | • {{#if: UbuntuHelp:LiveCD/Persistence|ગુજરાતી| [[::LiveCD/Persistence/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/he | • {{#if: UbuntuHelp:LiveCD/Persistence|עברית| [[::LiveCD/Persistence/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/hu | • {{#if: UbuntuHelp:LiveCD/Persistence|magyar| [[::LiveCD/Persistence/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/id | • {{#if: UbuntuHelp:LiveCD/Persistence|Bahasa Indonesia| [[::LiveCD/Persistence/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/it | • {{#if: UbuntuHelp:LiveCD/Persistence|italiano| [[::LiveCD/Persistence/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ja | • {{#if: UbuntuHelp:LiveCD/Persistence|日本語| [[::LiveCD/Persistence/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ko | • {{#if: UbuntuHelp:LiveCD/Persistence|한국어| [[::LiveCD/Persistence/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ksh | • {{#if: UbuntuHelp:LiveCD/Persistence|Ripoarisch| [[::LiveCD/Persistence/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/mr | • {{#if: UbuntuHelp:LiveCD/Persistence|मराठी| [[::LiveCD/Persistence/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ms | • {{#if: UbuntuHelp:LiveCD/Persistence|Bahasa Melayu| [[::LiveCD/Persistence/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/nl | • {{#if: UbuntuHelp:LiveCD/Persistence|Nederlands| [[::LiveCD/Persistence/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/no | • {{#if: UbuntuHelp:LiveCD/Persistence|norsk| [[::LiveCD/Persistence/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/oc | • {{#if: UbuntuHelp:LiveCD/Persistence|occitan| [[::LiveCD/Persistence/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/pl | • {{#if: UbuntuHelp:LiveCD/Persistence|polski| [[::LiveCD/Persistence/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/pt | • {{#if: UbuntuHelp:LiveCD/Persistence|português| [[::LiveCD/Persistence/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ro | • {{#if: UbuntuHelp:LiveCD/Persistence|română| [[::LiveCD/Persistence/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/ru | • {{#if: UbuntuHelp:LiveCD/Persistence|русский| [[::LiveCD/Persistence/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/si | • {{#if: UbuntuHelp:LiveCD/Persistence|සිංහල| [[::LiveCD/Persistence/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/sq | • {{#if: UbuntuHelp:LiveCD/Persistence|shqip| [[::LiveCD/Persistence/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/sr | • {{#if: UbuntuHelp:LiveCD/Persistence|српски / srpski| [[::LiveCD/Persistence/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/sv | • {{#if: UbuntuHelp:LiveCD/Persistence|svenska| [[::LiveCD/Persistence/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/th | • {{#if: UbuntuHelp:LiveCD/Persistence|ไทย| [[::LiveCD/Persistence/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/tr | • {{#if: UbuntuHelp:LiveCD/Persistence|Türkçe| [[::LiveCD/Persistence/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/vi | • {{#if: UbuntuHelp:LiveCD/Persistence|Tiếng Việt| [[::LiveCD/Persistence/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/yue | • {{#if: UbuntuHelp:LiveCD/Persistence|粵語| [[::LiveCD/Persistence/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/zh | • {{#if: UbuntuHelp:LiveCD/Persistence|中文| [[::LiveCD/Persistence/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/zh-hans | • {{#if: UbuntuHelp:LiveCD/Persistence|中文(简体)| [[::LiveCD/Persistence/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:LiveCD/Persistence | UbuntuHelp:LiveCD/Persistence | {{#if: | :}}LiveCD/Persistence}}/zh-hant | • {{#if: UbuntuHelp:LiveCD/Persistence|中文(繁體)| [[::LiveCD/Persistence/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:LiveCD/Persistence|:LiveCD/Persistence|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :LiveCD/Persistence/zh | | {{#ifexist: LiveCD/Persistence/zh | | {{#ifeq: {{#titleparts:LiveCD/Persistence|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:LiveCD/Persistence|1|-1|}} | zh | | }}
This page explains how to enhance a read-only LiveCD by adding persistent file storage on another drive. In more recent Ubuntu versions, you can instead use the usb-creator tool to create a bootable USB flash drive from a Live CD, and its user interface has an option to add persistent storage on the same USB drive; see Installation/FromUSBStick.
Introduction
Live CDs and !LiveUsbs provide a highly portable, secure, dependable and familiar environment that is easy to use on almost any machine. However, LiveCd sessions become even more useful when a persistent image can retain data and settings (even installed programs and packages) when the machine gets switched off. All the data can be easily pocketed and kept safe, perhaps to be physically carried to another machine. The advantages over Cloud Computing are; that it does not require a working internet connection, it gives better privacy and security as it does not place your data in other peoples possession. A persistent image will need to be kept on a Usb-stick or external hard-drive to really maximise on the usefulness of the LiveCd session so that is what this guide describes. It would also be possible to keep the image on a local hard-drive or any device the CD can see attached to the computer. Please keep it backed-up elsewhere too. The main usefulness would seem to be from using a Usb-stick. Note that programs and packages may take up a high percentage of the valuable space so it might be worth considering creating a | Customised CD or | Remix every once in a while, updating with packages you have installed in the persistent image since making the last Remix.
Getting the Live CD
Live CD persistence is a feature of the Ubuntu 6.06 LTS "Dapper Drake" release. You can download the latest version of the Live CD here: http://cdimage.ubuntu.com/releases/dapper/release.1/ update for Lucid http://cdimage.ubuntu.com/daily-live/current/ to save yourself a cd, simply save then mount the .iso file; to customize the packages etcetera contained in the Live cd, see LiveCDCustomization
Versions Tested
- 8.10 "Intrepid Ibex" - Works, use "usb-creator" tool to automate process after creation of the partitions; automatic syslinux.cfg may be more workable than the syslinux.cfg listed here; automatic syslinux.cfg however contains no reference to a persistent boot
- 8.04 "Hardy Heron" - Doesn't work
- 7.10 "Gutsy Gibbon" - Works on official release
- 7.10 "Gutsy Gibbon" Tribe 1 release - Doesn't work (more information below)
- 7.04 "Feisty Fawn" Doesn't work
- 6.10 "Edgy Eft" - Works
- 6.06 LTS "Dapper Drake" - Works
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"; please see changes below as per this thread 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 do a # sudo e2label /dev/<yourpartition> casper-rw
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:
df -h
The output of df -h should look something like this:
Filesystem Size Used Avail Use% Mounted on /dev/hda1 187G 4.0G 183G 3% / varlock 9.3G 507M 8.8G 6% /var/lock udev 506M 156K 506M 1% /dev devshm 506M 0 506M 0% /dev/shm /dev/hdb3 7.5G 1.4M 7.5G 1% /tmp /dev/hdb2 9.3G 507M 8.8G 6% /var /dev/sda1 124M 31M 94M 25% /media/USB DISK
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):
sudo fdisk /dev/sda
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 <ENTER> to print the current partition table. The output of this command should look something like this:
Command (m for help): p Disk /dev/sda: 130 MB, 130023424 bytes 16 heads, 32 sectors/track, 496 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 496 126960 6 FAT16
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): d Partition number (1-4): 1 Command (m for help): d Partition number (1-4): 2 Command (m for help): d Partition number (1-4): 3 Command (m for help): d Selected partition 4 Command (m for help): p Disk /dev/sda1: 130 MB, 130007040 bytes 16 heads, 32 sectors/track, 495 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System 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 <ENTER> to write the partition table changes to your USB Stick. Here is the output from my session:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-495, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-495, default 495): Using default value 495 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 22: Invalid argument. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks.
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:
sudo umount /dev/sda1
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:
sudo mkfs.ext3 -b 4096 -L casper-rw /dev/sda1
The output of this command should look something like this:
mke2fs 1.38 (30-Jun-2005) Filesystem label=casper-rw OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 31744 inodes, 31740 blocks 1587 blocks (5.00%) reserved for the super user First data block=0 1 block group 32768 blocks per group, 32768 fragments per group 31744 inodes per group Writing inode tables: done Creating journal (1024 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 20 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
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.
$ dd if=/dev/zero of=/media/hda1/casper-rw bs=1M count=128 128+0 records in 128+0 records out 134217728 bytes transferred in 0.947819 seconds (141606919 bytes/sec)
$ mkfs.ext3 /media/hda1/casper-rw mke2fs 1.38 (30-Jun-2005) /media/hda1/casper-rw is not a block special device. Proceed anyway? (y,n) y Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 32768 inodes, 131072 blocks 6553 blocks (5.00%) reserved for the super user First data block=1 16 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 23 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
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 <F6> 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 :) 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
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 <F6>, 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.
Automatic Persistence
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
Gutsy Gibbon Notes
It is currently unknown what is the problem with LiveCDPersistence and Gutsy Tribe 1. By reading the persistence problems with Feisty, I have guessed that Casper is at fault. 2007-10-04 - Gutsy beta 1 2007-09-28 - SUCCESS I can report success using the Gutsy beta (2007-09-28) and persisting to a USB stick using the above steps (grub option "persistent" at boot, "casper-rw" label on ext3 fs USB stick partition). My home directory, bookmarks, preferences etc. are persisting between Live CD boots. This is using a Thinkpad X60s -- Alastair
Conclusion
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!
Outstanding Questions
- What is the min. USB key size that is needed? How about adding a swap partition to the USB key?
- Wouldn't the Live CD rock more if the end-user didn't have to fudge around with kernel arguments and the Live CD just did what was right, to wit: if there is a removable media device labelled "casper-rw" and formatted appropriately, use it (or at least ask) and if there isn't, don't? See either of these 2 guides
- https://help.ubuntu.com/community/LiveCDCustomizationFromScratch
- https://help.ubuntu.com/community/LiveCDCustomization
- Wouldn't it rock still further if the instructions provided were done up as a quick'n'dirty GUI (Knoppix-style) which allowed an end-user to make their persistent store without having to fudge around with the CLI at all?
- Is there a way to use a (luks)encrypted usb stick?
- Every single disk write goes to the USB stick, which GNOME loves to do all the time. After following these directions, I booted the LiveCD using the "persistent" boot option. All I did was change the desktop background to a solid color and visit Slashdot's front page in Firefox. Then I powered down the system and looked at how much written data was saved on the USB stick. 75 MB! Most was gnome-related stuff under /var/lib. Ouch. And the USB stick got written to the whole time pretty much. Won't that wear out the USB stick much faster? Can't the changes be dumped in bulk only once in a while, when the user presses a button on some applet? And only that data that is in the user's home directory? This will keep the USB stick from wearing out. SLAX has got scripts to do this already that could perhaps be copied. Especially see the SLAX script called "configsave".
- How can the USB stick be set up to have everything included? There's no reason for a 700 MB CD if the USB disk has a couple of GB's today. Would this be an entire ubuntu installation on the USB disk?. For this, one can use Ubuntu Live CD installation icon on the desktop.
Keep in mind that not everybody we want to convert to Ubuntu is a power user (administrator). I can pretty much guarantee that anything that looks like typing Scary Strings is going to turn people off, not on, no matter how "powerful" it is behind the scenes. This feature (and the whole Ubuntu Live CD release) rocks, and I agree that it would rock even more if one could do it without CLI commands. It seems there is only a small number of places where the persistence can be stored (USB key and loopback file). The ideal solution would therefore seem to be an option at startup to create persistence in the one or few places where it is possible (including the hard drive), and the default option would look for persistence file and allow a choice if more than one is found (I wonder how is that dealt with currently?). This is option is absolutely ideal for people stuck with corporate computers, that want to start moving towards Linux, but are afraid to mess with their partitions just yet. Suggestion: Actually very little CLI commands are needed, as nearly all of it can be done using the Gnome Partition Editor which is in the Administration menu. However it does not have an option for setting the disk label. In the 'Device' menu there's a 'Set Disk Label' item, however that's not it. :) This wiki page should probably be redone using the Gnome Partition Editor tool, and loads of screen shots.
External Links
https://wiki.ubuntu.com/LiveUsbPendrivePersistent