Page 1 of 1

HOWTO: Create a persistent USB

Posted: Thu Jul 11, 2013 4:41 pm
by pidsley
Here is how I created a persistent Gangbang USB stick.

Create two partitions on your USB stick. One partition needs to be big enough to hold the iso, the other partition should use all the remaining space. I used a 8G USB stick, so I created a 1G partition for the iso and the remaining space for persistence.

NOTE: The rest of the commands in this topic assume that you are running as root. Use "su" or "sudo su" to become root. BE CAREFUL! This example also assumes that your USB stick is "sdb" -- change the code accordingly if this is not true for your machine. BE CAREFUL!

Put a fat32 filesystem on the first partition, and an ext2 filesystem labled "persistence" on the second partition:

Code: Select all

mkfs.vfat /dev/sdb1
mkfs.ext2 -L persistence /dev/sdb2
Mount the first partition (unetbootin requires this):

Code: Select all

mount /dev/sdb1 /mnt
Use unetbootin to put the iso on the sdb1 partition. When unetbootin finishes, select "exit"

Edit the syslinux.config file on /dev/sdb1 (mounted at /mnt):

Code: Select all

nano /mnt/syslinux.cfg
Add the word "persistence" to the end of the "append" line for the first entry, and (optionally) change the menu label of the first entry. For Gangbang, I changed this:

Code: Select all

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit boot=live ip=frommedia union=aufs video=uvesafb:mode_option=1024x768-16@60 vga=current init=/bin/systemd
To this:

Code: Select all

label unetbootindefault
menu label Gangbang (with persistence)
kernel /ubnkern
append initrd=/ubninit boot=live ip=frommedia union=aufs video=uvesafb:mode_option=1024x768-16@60 vga=current init=/bin/systemd persistence
Save the file. Unmount the first partition, and mount the second:

Code: Select all

umount /mnt && mount /dev/sdb2 /mnt
Create a file called "live-persistence.conf" at the root of the partition:

Code: Select all

nano /mnt/live-persistence.conf
Put this one line in live-persistence.conf (note that there is a space between "/" and "union"):

Code: Select all

/ union
Save the file, and unmount the partition.

Code: Select all

umount /mnt
Boot your new persistent USB.

References:
http://live.debian.net/manual/3.x/html/ ... n.html#529
http://crunchbang.org/forums/viewtopic. ... 78#p297178

Re: HOWTO: Create a persistent USB

Posted: Tue Jul 16, 2013 10:00 am
by Distrohopper79
Tip:

Code: Select all

nano /mnt/live-persistence.conf
/ union
You can use this:

Code: Select all

echo “/ union” >> /mnt/live-persistence.conf
:)

Re: HOWTO: Create a persistent USB

Posted: Tue Jul 16, 2013 12:49 pm
by rhowaldt
^ true... now try the challenge of writing all of pidsley's instructions on a single commandline. it can be done! :D
i think the reason pidsley went with the nano option was for clarity, or maybe just because he prefers to do it that way. still, a valid point :)

Re: HOWTO: Create a persistent USB

Posted: Tue Jul 16, 2013 1:06 pm
by dkeg
@pids ... thank you for the how-to. Well written as usual.
@rho ... thanks for the laugh this morning. Witty as usual.

now go to Metal corner and check out some Big Black!

Re: HOWTO: Create a persistent USB

Posted: Tue Jul 16, 2013 2:22 pm
by machinebacon
Well the difference is that pidsley's method works for su and sudo.

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 1:51 am
by MrDowntempo
Does this still work? I tried it with break! and I couldn't get the USB to boot properly after. I'm really after a persistent USB that I can install and test different CLI programs on in openbox, so I thought that'd be fantastic, but after following the instructions I was left with an unbootable USB according to the two machines I tested it on. The same ISO copied with something like etcher.io boots fine in a non permanent way though.

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 2:40 am
by machinebacon
What does unbootable mean?

- it doesn't get recognized in the boot selection
- it does get recognized but SYSLINUX shows some error
- it does get recognized, the boot menu of Unetbootin appears, but none of the selections boot

There is aline that needs to be changed:

Code: Select all

init=/bin/systemd
This has to point at the actual init file of your system, for example init=/sbin/init (see https://wiki.debian.org/BootProcess)
We had used systemd as init system but ditched it 3 years ago in favour of sysvnit.

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 6:28 am
by MrDowntempo
I get a 'Missing Operating System' error after selecting the USB drive from my bios boot menu. I hadn't added the systemd init line previously because break! didn't have an init line at all there. I added init=/sbin/init but it didn't help :)

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 8:04 am
by machinebacon
Honestly, no idea. Let us know what you find out.
http://crunchbang.org/forums/viewtopic. ... 11#p438311

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 2:21 pm
by pidsley
These instructions are OLD! I'm not surprised they don't work.

You might be better off trying something like this: http://syn.theti.ca/2013/06/22/tutorial ... ce-on-usb/

With the change noted by xaos here: https://forums.bunsenlabs.org/viewtopic ... 6886#p6886

Or these instructions: https://forums.bunsenlabs.org/viewtopic ... 6974#p6974

With the appropriate changes in the name of the iso, of course.

Re: HOWTO: Create a persistent USB

Posted: Thu Jun 02, 2016 7:46 pm
by doubledutch