Linux.com

Home Linux Community Community Blogs General Linux Creating a Debian Live USB Flash Drive with Persistence for Non-Techies

Creating a Debian Live USB Flash Drive with Persistence for Non-Techies

This tutorial aims at showing a fast, straightforward way of creating a  USB flash drive with Debian live installed (on it) using the persistence feature. It means that you can automatically save changes back to the USB flash drive before shutting your machine down.There are many more options not covered in this article which are explained in detail in Debian-live's manual. You can find it here.
This tutorial aims at showing a fast, straightforward way of creating a  USB flash drive with Debian live installed (on it) using the persistence feature. It means that you can automatically save changes back to the USB flash drive before shutting your machine down.There are many more options not covered in this article which are explained in detail in Debian-live's manual. You can find it here.
 
In order to follow this tutorial you need:
 
-A machine with linux installed.
 
-A FAT formatted usb flash drive of 4 GB (2GB will do since the image is 1.1 GB but this leaves little free space for persistence)
 
-A good internet connection to download an image of 1.1 GB.
 
-A basic knowledge of the command line.
 
-Sudo access to your machine. You must be in the sudoers file.
 
-Software/commands: bash, wget, mount, dd and gparted. 
 
 
1. Download a usb-hdd image from live.debian.net  A direct link to the latest stable release is here
 
In order to achieve that, open a terminal. Type:
 
$ wget http://cdimage.debian.org/cdimage/release/current-live/i386/usb-hdd/debian-live-6.0.0-i386-gnome-desktop.img
 



With a fairly good connection it should not take longer than 20 or 30 minutes.
 
 
 
2. Plug in the flash drive and open a terminal. Type:
 
 
$ mount (In order to know the device name of your pendrive).
 
 
There should be an entry similar to this one:
 
/dev/sdc1 on /media/Kingston DataTraveler G2: 4.0 GB Filesystem type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush)
 
 
 
Here is important to remember /dev/sdc (your device name can be different like for example /dev/sdb) Just make sure that the name belongs to the usb you want to copy the live image to. Otherwise you risk losing important data.
 
 
3. Once the download is finished. Copy the image to the usb flash drive. In order to do that open a terminal and type:
 
 
$  dd if=debian-live-6.0.0-i386-gnome-desktop.img of=/dev/sdc (Remember to replace sdc with the actual name of your device.) 
 
 
 
4. Wait for it to finish. (It might take a while)
 
 
 
5. It is time to make a new partition to use the space left on the flash drive to save changes.  Then type:
 
$ sudo gparted
 
gparted interface looks like this:

 
 
6. Gparted interface is very intuitive. Select the device from the drop down menu. Remember in this tutorial it is /dev/sdc
 
You must unmount the device. So first right click on it and select unmount.
 
 
7. Right click on the device and select new (To create a new partition). A new window opens.
 


 
8. Complete:
 
- Create as: Primary partition
 
-File System: ext2 
 
-label: live-rw
 
Select Add and then apply changes. You'll see something similar to this:




Unplug. Now you can boot from the usb Flash drive using persistence.
 
 
9. In order to use persistence you have to boot a machine from the usb device. You must first ensure that your bios is capable of booting from usb. Enter the bios and check that. 
 
First thing you will be presented with the splash screen:

 
10. Press ESC to see the boot prompt and type "live persistent" (Without quotes)
 

You are done. You can now use the system as you like and all the changes that you make will be saved in the partition you've created.
 
 
 
Only one thing left to say: ENJOY!!!!
 

Comments

Subscribe to Comments Feed
  • Quinn Said:

    Wow, thanks for that! I was trying to do this, and it was giving me problems. Just curious: would this work on Lubuntu as well?

  • Hobby Logic Said:

    For Quinn: The steps are corrects 100% For Author: The shortest and best article regarding the subject. Thanks!

  • Garry Conn Said:

    Thanks for creating the tutorial. Quick question -- why do you have type live persistent compared to just loading the Live option?

  • Oz Said:

    Hello. I've followed those instructions, but I cannot access a wireless network from the live install nor see the live-rw filesystem there. I downloaded the xfce4 version (that shouldn't matter, right?). Do you know what could be happening?? Thanks in advance!

  • Rulet Said:

    Hello chals. Do you know the working method of installing debian-installer on such a live-flash with Debian Wheezy?

  • Lúcio Said:

    Fiz esse procedimento com uma distro chamada SOluOS e funcionou perfeitamente. Gostaria de saber se esse procedimento funcionaria com uma distro baseada em Ubuntu. Obrigado.

  • Chinux Said:

    At the end the when it is rebooting, do we have to type live persistent each time we turn it on? or is it just one time? Thanks for the tutorial.

  • fenriv Said:

    You can create new menu section in /syslinux/live.cfg on top of other menu items: label persistent menu label Live persistent kernel /live/vmlinuz append initrd=/live/initrd.img boot=live persistent quiet

  • FBP Said:

    I've tried this with debian-live-7.0.0-i386-xfce-desktop.img. When I hit ESC to get the boot prompt and then type live persistent I get this error: Could not find kernel image: live Hmmm... The live usb boots OK, but I can't get the persistence to work. Ideas?

  • logan Said:

    Same exact thing literally that same EXACT problem try pressing tab at splash and adding "persistent" to the end of the string also try replacing your live.cfg with this one: https://docs.google.com/file/d/0B5-cDpAgfDfsMExwVjUwSTNlOWc/edit?usp=sharing

  • FBP Said:

    Thank you for your reply. I hit tab at splash, type persistent, hit enter. I get "Could not find ramdisk image: /live/initrd1.imgpersistent". Hmmm... Start over. So: I started with a FAT32-formatted flash drive. I did the dd command with debian-live-7.0.0-i386-xfce-desktop.iso. Then I made an ext2 partition labeled live-rw in the remaining space. This makes a bootable flash drive, but persistence doesn't work. Also I can't edit /syslinux/live.cfg when booted from the flash drive (no persistence), but when booted from another drive I can't mount the partition, /dev/sdb1, that the dd command created. It shows up in gparted as "File system unknown" and can't be mounted, so I can't edit /syslinux/live.cfg that way either. I'm confused :\

  • Rick Said:

    After you hit TAB type persistent to separate the word "persistent" from the end of the existing line. It's not obvious you need a space because of word wrap

  • ipse lute Said:

    Freaking amazing! So simple and clear! Thanks a bunch, mate.

  • Robin Said:

    How dumb to need linux already to do this. Kinda defeats the purpose if your a new linux user trying out a live version. I don't have a linux machine and all the live versions that go on USB are in an img format. Trying to get a linux distro that works with a Vortex86MX processor used in a mini-pc appliance. Puppy Linux works but it does a dirty unmount at shutdown and Clonezilla won't take an image of a dirty drive. Think it's time to try another distro.

  • Mr. Jan Hearthstone Said:

    How did the boot flag get to be on that snapshot of gparted? Thanks, Hearthstone.

  • Ed Said:

    Thanks for such a nice tutorial. I wrote a new tutorial on how to get persistance based on Debian's Live ISO-HYBRID images. You can find it in here: http://cosmolinux.no-ip.org/raconetlinux2/persistence.html I wish it is useful to someone.

  • Claire Said:

    I found it exceedingly useful! :) Things weren't going as smooth with the tutorial above, but following yours helped :)

  • herbie Said:

    thanks works but i see something strange during boot: home directory / not ours multiple times. Is there any workaround for this error? persistence works I dont know why I see this

  • Patrick Said:

    There should be a couple of things added/changed to this tutorial. I was trying to get a debian usb key that worked for a mac with persistence. I ended up using this tutorial with a combination of other sources. Everything up to creating the persistent partition is correct. Beyond that you should call the new ext4 partition "persistence" in keeping with the new format of the debian images. Additionally you should create a file (or two) in the persistence partition called either live-persistence.conf or persistence.conf (I'm still not sure which so I created both). All these files need to contain is the line "/ union" (no quotes). Lastly, when you are booting you should hit tab at the splash screen and add (with a space between the rest of the command) "persistence", not persistent. As someone mentioned above, you can also alter the boot menu so that you don't have to type "persistence" in every time you load your system. I hope this helps anyone who gets a change to read it! Cheers, Patrick

  • Microman Said:

    Hi Chals, Its been a great pleasure reading this step by step guide for newbies, could we also add toram option by any simple methods? If you could enlighted me regarding this issue, I'd be in your debt!

  • Rajesh Sali Said:

    Sir, I have downloaded the http://cdimage.debian.org/debian-cd/7.5.0/multi-arch/iso-dvd/debian-7.5.0-i386-amd64-source-DVD-1.iso Now I used pendrivelinux to write it to my pen drive but the resulting system was an Install image rather than a live image. Is it possible for me & HOW (if yes) to create a live debian image from the .iso I have downloaded ? Eagerly awaiting response. Thanks, Rajesh.

  • Rajesh Sali Said:

    Sir, I would like to know how to create a live .iso from a standard install .iso in WINDOWS (using windows operating system)

Upcoming Linux Foundation Courses

  1. LFD331 Developing Linux Device Drivers
    25 Aug » 29 Aug - Virtual
    Details
  2. LFD411 Embedded Linux Development
    25 Aug » 29 Aug - Santa Clara, CA
    Details
  3. LFS422 High Availability Linux Architecture
    08 Sep » 11 Sep - Raleigh, NC
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board