HOWTO: Create a persistent USB

Forum rules
Share your brain ;)
pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

HOWTO: Create a persistent USB

Unread post by pidsley » Thu Jul 11, 2013 4:41 pm

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

Distrohopper79
Virgin
Posts: 5
Joined: Mon May 27, 2013 7:40 pm

Re: HOWTO: Create a persistent USB

Unread post by Distrohopper79 » Tue Jul 16, 2013 10:00 am

Tip:

Code: Select all

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

Code: Select all

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

channel is good kick JensNDS sometimes or autokick for every 30mins idle from chanserv

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: HOWTO: Create a persistent USB

Unread post by rhowaldt » Tue Jul 16, 2013 12:49 pm

^ 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 :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: HOWTO: Create a persistent USB

Unread post by dkeg » Tue Jul 16, 2013 1:06 pm

@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!

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO: Create a persistent USB

Unread post by machinebacon » Tue Jul 16, 2013 2:22 pm

Well the difference is that pidsley's method works for su and sudo.
..gnutella..

MrDowntempo
Distrowatcher
Posts: 2
Joined: Sun Sep 13, 2015 6:07 pm

Re: HOWTO: Create a persistent USB

Unread post by MrDowntempo » Thu Jun 02, 2016 1:51 am

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.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO: Create a persistent USB

Unread post by machinebacon » Thu Jun 02, 2016 2:40 am

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.
..gnutella..

MrDowntempo
Distrowatcher
Posts: 2
Joined: Sun Sep 13, 2015 6:07 pm

Re: HOWTO: Create a persistent USB

Unread post by MrDowntempo » Thu Jun 02, 2016 6:28 am

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 :)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: HOWTO: Create a persistent USB

Unread post by machinebacon » Thu Jun 02, 2016 8:04 am

Honestly, no idea. Let us know what you find out.
http://crunchbang.org/forums/viewtopic. ... 11#p438311
..gnutella..

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: HOWTO: Create a persistent USB

Unread post by pidsley » Thu Jun 02, 2016 2:21 pm

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.


Post Reply