69

I want to make a persistent live Ubuntu USB drive with more than 4GB of storage.

I know there is an option of installing directly on the drive but I don't want to do this as it will restrict the drive from working on different computers.

One option is to make an additional partition with extra space but if I do this how can I get newly installed software to be stored on this partition?

4
  • 4
    Doing a Full install to USB drive will not restrict the drive from working on other computers unless proprietary drivers are installed, (Nvidia, etc). Feb 8, 2016 at 3:37
  • 1
    I agree that installing to the USB drive as if it was an internal drive is a non-solution. I tried it, in fact. First, Ubuntu installation is not intended for this mode. For example, it asks for the computer name, which makes little sense in this case. I imagine, some drivers can be configures, installed, or uninstalled, depending on the actual hardware. Second, this installation method on an UEFI system will overwrite the Ubuntu's dedicated EFI directory on the ESP, and to boot the Ubuntu on the internal hard drive, the GRUB loader on the USB drive would need to be used during boot.
    – Alexey
    Jan 28, 2018 at 22:13
  • I figured out how to do this without persistence, for those that are looking for that solution. askubuntu.com/questions/1434508/… Oct 12, 2022 at 22:29

7 Answers 7

40

The current Unix USB Installers (e.g. Universal USB Installer from PenDriveLinux.com) create a persistent file on the boot partition together with the other files needed for booting. This boot partition is formatted with FAT32 and because of limitations in FAT32, the maximum size of this file is 4GB. To have more persistent storage, this file can be replaced by a partition. The size of such a partition is only limited by the size of the USB drive.

I used the GParted partition manager to resize the FAT32 partition and make space for a big EXT4 partition for the persistent storage. The persistent file can simply be deleted and at the next boot, the Ubuntu system will automatically use the bigger persistent partition. There is one complication, though: you need another Ubuntu system to do this because Ubuntu cannot modify its own active boot partition.

I used a 2nd USB drive with Ubuntu live. For the instructions below I used "32 bit Ubuntu 13.10 desktop" version.

  1. Install Ubuntu live on 2 USB drives. Configure a small persistent storage of around 100 MB for each of the USB drives.

  2. Boot Ubuntu from one of the USB drives. Make sure the other USB drive is unplugged.

  3. Start "GParted Partition Editor" from the Ubuntu Dash. This partition manager is default installed in 13.10.

  4. Insert the other USB drive, wait a short moment and do a refresh in GParted (Ctrl+R). You will notice that a new device is added at bottom of the list of devices. Check that the size matches with the target USB drive. Select this device (see example picture below, the device name can be different on your system).

  5. Check that the mount point (/media/ubuntu/UUI) is identical as in above picture.

  6. Open a terminal window (Ctrl+Alt+T) and remove the persistent file with the following command (adjust this command if the mount point is different in your case):

    rm -v /media/ubuntu/UUI/casper-rw
    
  7. Refresh GParted (Ctrl+R) and notice the change in "Used".

  8. Right-click on the partition and select unmount. You will notice that the Mount Point is no longer displayed.

  9. Right-click on the partition and select Resize/Move. Select New size: 1000. This will leave some space to store additional or updated files. Click "Resize/Move". An "unallocated" partion will appear

  10. Now create a new partition for the persistent storage. Select the unallocated partition and right click on New.

  11. Select file system “ext4“ and label casper-rw and click Add.

  12. Check if everything looks OK and click on the green check mark to apply all pending operations.

  13. Shut down Ubuntu, remove the first USB drive (this USB drive is no longer needed) and reboot from the second USB drive.

  14. Open a terminal (Ctrl+Alt+T) and type the following command:

    df . -h
    

    Check that the Avail size matches with the persistent partition size you created.

6
  • This worked to me up until clicking the check mark to apply all operations. Then I got an error message from linux, I forget the exact wording but the 'system detected an error would you like to report the problem' one. I went back into gparted and I am unable to mount, resize, create partition or do anything to the drive now. Should I just format it and start over?
    – user137717
    Aug 18, 2015 at 4:24
  • 1
    This method does not work with 64 bit Ubuntu 14.04 and later. Feb 8, 2016 at 11:45
  • @C.S.Cameron what part doesn't work? is it not persistent?
    – Matt G
    Aug 1, 2016 at 18:43
  • 2
    This doesn't work for me either. After deleting casper-rw file it stuck at BusyBox screen on next boot.
    – kirtan403
    Aug 30, 2016 at 8:55
  • 1
    It seems to have stoped working in latest Ubuntu...
    – lf_araujo
    Sep 23, 2016 at 1:07
31

I would like to expand on the answer by V Bota and sudodus.

I wrote much of this for another question but I think it would serve better here.

I too have previously tried many different instructions without success and had almost given up when I found a working method using the very nicely created mkusb tool.

Prior Considerations

I am assuming you have the .iso file (of Ubuntu 16.04/any *buntu) already downloaded. If not get it.

I have tried running these instructions from an installed Ubuntu system.

Note: There is currently a limitation that efi-enabled OSes wont work in BIOS mode. To bypass the restriction, run all these steps from another live system.

Installing mkusb

Boot into an existing Ubuntu or live-boot the secondary Ubuntu flash drive.

Open a terminal (Ctrl+Alt+T) and run the following commands one by one:

sudo add-apt-repository universe
sudo add-apt-repository ppa:mkusb/ppa
sudo apt-get update

sudo apt-get install mkusb usb-pack-efi

The last command might fail (though unlikely) as mkusb (GUI version) has some dependencies that are not preinstalled/active in the live version of Ubuntu.

No need to panic though, the developer has also created a text only version. Run:

sudo apt-get install mkusb-nox usb-pack-efi

Creating the persistent drive

I will focus on the main GUI version as that is the one I have used. So if you installed the default mkusb (GUI version) run:

dus

dus is an alias for the latest updated new-look of mkusb. It is a revamp of the old version and even more easy to use.

After you run the command the GUI will open. Follow these steps next:

  • Screen 1: Note the warning and click OK
  • Screen 2: Double-Click on the i option Install(make a boot device)
  • Screen 2: Double-Click on the p option Persistent Live and select the .iso file.
  • Screen 3: Tick the device you want to install to and click OK
  • Screen 4: Just click Use defaults and let mkusb decide what's best. (Or choose, but wisely.)
  • Screen 5: Enter the percentage of USB drive space you want to allot for persistence file-system. The remaining will later show up as portable storage device.
  • Screen 6: Double check you have selected the right device and settings. Tick the Go radio button and click Go.
  • Screens 7,8,: Just click Ok and let mkusb do its thing.

Done!

Now plug your newly made persistent drive in any system and check if it really stores data/settings across reboots (Mine does).

Screenshots

The whole process should look something like the following.

Run the command in terminal:

Run the command in terminal


Note the warning and click OK:

Welcome and Notice


Double-Click on the i option Install(make a boot device):

Task To Perform


Double-Click on the p option Persistent Live and select the .iso file:

Live-only or Persistent


Click on the USB drive to make persistent. I want to use my 32 GB one so I mark the radio button:

Select_target_device


Click Use Defaults to let mkusb choose default:

Custom options or default


Enter a percentage of the drive to reserve for persistence. Mine is a large (32GB) so I allot only 20% ~ 6GB. The remaining space will be turned into an empty portable drive:

Enter Space for Persistance


Double check very carefully and confirm. You don't want to mess up another drive.

Double check and confirm


If all goes well you will be greeted by a nice green finished screen:

Finished Successfully



Now plug your newly made persistent drive in any system and check if it really stores data/settings across reboots (Mine does).

References & Acknowledgenent

You can refer to a nice tutorial by Calvin Bui here to guide you through the GUI step by step or read through the detailed documentation https://help.ubuntu.com/community/mkusb

Thanks again to V Bota for this answer and andrea-lazzarotto for helping edit this one.

10
  • I wasn't able to get these instructions to work using the 32-bit version of Ubuntu 14.04.5 when I tried it from within Ubuntu 12.04. When I switched to the 64-bit version and ran mkusb from Ubuntu 16.04.1 it worked. Thank you @Harsh for putting together such a comprehensive guide. I'm surprised it doesn't have more upvotes.
    – Adam
    Jan 5, 2017 at 19:47
  • 1
    Thank you @Adam for your encouragement. Personally I haven't experienced the problem myself. But I looked about and there seems to be an additional step for installing mkusb in Ubuntu 12.04 help.ubuntu.com/community/mkusb/install-to-ubuntu-12.04.
    – Harsh
    Jan 23, 2017 at 12:35
  • @Harsh , Please consider updating your answer with screenshots from mkusb version 12 alias dus :-) - It is still possible to select mkusb version 11 when you have installed mkusb version 12. I think some people prefer version 11, but I think version 12 is easier to use, particularly for new users.
    – sudodus
    Feb 19, 2017 at 7:49
  • @sudodus Sure , I'll update it soon. Although I'm in the middle of a very hectic week and don't have my Ubuntu PC handy so it might be a while. Thanks for the update though. :-)
    – Harsh
    Feb 19, 2017 at 12:55
  • 1
    @sudodus I have made the changes for this answer to be applicable to dus. Took a bit longer than expected :-)
    – Harsh
    May 30, 2017 at 19:11
15

After several failed attempts with Startup Disk Creator I finally succeeded with mkusb following the instructions from here: https://help.ubuntu.com/community/mkusb

or here: http://phillw.net/isos/linux-tools/mkusb/mkUSB-quick-start-manual.pdf

The following lines indicate the steps I tried and worked for me with Lubuntu 15.10 on the same OS.

  1. Install mkusb: If you run standard Ubuntu, you need an extra instruction to get the repository Universe. (Kubuntu, Lubuntu ... Xubuntu have the repository Universe activated automatically.)

    sudo add-apt-repository universe  # only for standard Ubuntu
    
    sudo add-apt-repository ppa:mkusb/ppa  # and press Enter
    sudo apt-get update
    sudo apt-get install mkusb mkusb-nox usb-pack-efi
    

    Upgrading from version 11 to version 12 requires some special commands. See this link,

    help.ubuntu.com/community/mkusb/gui#Upgrading_from_mkusb_11_to_12

  2. If you do not have an official ubuntu (Lubuntu, Xubuntu, Kubuntu ...) ISO image download one.

  3. Run mkusb from Dash or the menu (depending on flavour of Ubuntu) or in a terminal window with one of the following command lines

    mkusb version 12 alias dus:

    dus                   # getting into the main menu 'Install/Restore/Wipe'
    dus file.iso          # specifying a source file directly
    dus /dev/sdx          # specifying a source device
    

    mkusb version 9-11:

    sudo -H mkusb             # to get to the main menu
    sudo -H mkusb file.iso p  # source file and persistence via parameters
    

    when the password is requested enter the admin password

  4. then in mkusb's main menu select the ISO image you have downloaded.

  5. I have also toggled the option to have a persistent drive created.
  6. Select the option to install the selected ISO image.
  7. Click OK and then select the Drive on witch to install (BE careful to select the correct drive!)
  8. Choose the amount of memory you want to use for persistent data
  9. Click OK and wait for install to finish
  10. Then reboot system.

If you did not check it until now make sure that the bios settings allow booting from USB before HDD.

5
  • 2
    Thanks for this. Although mine failed when I chose 100% for my persistent storage space. I chose 90% and it worked. :)
    – jbrock
    Aug 2, 2016 at 0:36
  • 1
    Thanks for finding this bug :-) It will be fixed in mkusb 11.1.7
    – sudodus
    Nov 20, 2016 at 2:18
  • MKUSB DESTROYED MY USB, was a pain to install on LXLE, and even after format the USB never booted again.
    – user132992
    Aug 15, 2017 at 19:05
  • I tried running mkusb today. It succeeded at creating a bootable drive that contained a usbdata partition, but it doesn't seem to really be persistent: no settings or files (e.g. in ~) that I create on one usage are there for the next usage. This was with Ubuntu 18. I chose to create it persistent in mkusb, and chose persistent mode in the bootloader. Do you know if there's something I'm missing here? Jun 30, 2018 at 23:42
  • Thanks. In my case this procedure worked so well for Ubuntu 16.04 and fot Linux Mint 18.3!
    – jaumetet
    Aug 27, 2018 at 15:16
7

If you're on Windows, you can just use Rufus 3.8 or later, along with Ubuntu 19.10 or later (daily live ISOs of 19.10 can be found here), and set the persistent partition size to whatever size you want. Rufus is not limited to 4 GB for persistence and doesn't even require you to use NTFS either (FAT32 for the primary partition will work fine).

Yes, it is that simple:

  • Select your Ubuntu ISO
  • Move the persistent partition slider from 5 GB up to whatever size your drive will allow
  • Press START.

Note however that, because of Ubuntu/casper bug #1489855, you MUST use a version of Ubuntu where the aforementioned persistence bug has been fixed, which, currently, means only 19.10 (especially 18.04 LTS and 19.10 will NOT work).

This bug probably also explains why so many people have been having so much trouble getting persistent partitions to work with Ubuntu, as you literally should always have been able to simply create a casper-rw ext3 or ext4 partition on the same media and get that recognized for persistence. Sadly however, bug #1489855 got in the way until very recently...

(Disclaimer: I am the main developer for Rufus, and I invested a lot of time making sure that persistence would work with Ubuntu, starting with trying to make sure bug #1489855 was properly addressed).

4
  • 1
    +1, temporary comment: especially 18.04 LTS and 19.10 will NOT work --> especially 18.04 LTS and 19.04 will NOT work
    – sudodus
    Sep 26, 2019 at 15:57
  • 1
    rufus-3.7_BETA with eoan-desktop-amd64 worked perfect for me, will checkout rufus-3.8 next. Good job, glad to see persistent partitions working again with a Windows install of Ubuntu. Sep 26, 2019 at 16:17
  • 1
    Have you considered adding an option for a NTFS data partition, (such as mkusb has)? Sep 26, 2019 at 17:52
  • Ah shoot! I wish SO/AU allowed to edit comments for more than 5 mins so that I could fix the 19.10 vs 19.04 typo. With regards to NTFS data partition, first of all, it's a bit tricky on Windows because anything prior to Windows 10 1703 cannot mount 2 partitions at once from removable media. Also, I don't see much point in doing so now that we have persistence. People can tailor the size of the FAT32 and persistent partition, so they can already use the drive to exchange data with systems that don't support ext and I really fail to see a common scenario where the 4GB file limit is an issue.
    – Akeo
    Sep 26, 2019 at 20:15
5

Update Aug/2017 - Persistence files greater than 4GB

Syslinux started adding support for NTFS with version 4.06 but did not offer full support until version 6.03.

UNetbootin - 655 uses Syslinux 4.03 and is limited to 4GB persistence files per FAT32.

MultiBootUSB - 8.8 uses Syslinux 4.07 and will install on NTFS, persistence files are not limited to 4GB.

Rufus 2.16 uses Syslinux 6.03 and will install on NTFS, persistence files are not provided but can be added manually and are not limited to 4GB.

YUMI - 2.0.4.9, (MultiBoot USB), uses Syslinux 6.03 and will install on NTFS, persistence files are not limited to 4GB. Like MBUSB 8.8 it can have persistence files for each distro installed.

2

Mkusb is now my favorite Live/Persistent flash drive maker for Linux, however the OP has been misinformed about a Full install not working on multiple computers.

A Full install to USB will work on any computer a persistent install will work on as long as proprietary drivers have not been installed.

Not only that but a Full install has other advantages such as booting much faster, being updateable, etc.

https://ubuntuforums.org/showthread.php?t=1655412

2
  • I think what he meant is that a full install will be in ext4 and prevents the drive from being used as data drive on other Windows PCs. However that's easy to overcome
    – phuclv
    Mar 2, 2018 at 12:07
  • @Lưu Vĩnh Phúc Yes, as long as the first partition is a Windows compatible file system, (FAT32 or NTFS), the USB can be used as a data drive on Windows PCs, If it is a Windows 10 PC, it does not even need to be the first partition. Mar 2, 2018 at 16:04
1

Add a Persistent Partition to a UNetbootin Persistent USB, (Ubuntu 19.10+)

No additional USB drive required.

  • Back up the bootable drive, copy and preserve it's casper-rw file.

  • Boot the USB drive "toram", At the UNetbootin boot menu press the Tab key. type a space then "toram" and hit enter.

Now the computer will boot toram (8GB RAM required for UNetbootin drive). You will be able to edit and overwrite the Live USB.

We will add a persistent partition and a NTFS partition (for data storage).

  • Open GParted, select the USB drive and unmount it.

  • Shrink the FAT32 partiition to a minimum.

  • Add a new ext4 partition for persistence.

  • Label the ext4 partition "casper-rw".

  • In the remaining space create a NTFS partition.

  • Apply all Operations.

  • Reboot in order to populate the casper-rw partition.

Now we copy the existing casper-rw file to the new casper-rw persistent partition:

Mount old casper-rw file:

  • sudo mkdir /media/casper

  • sudo mount -o loop /cdrom/casper-rw /media/casper/

Copy old casper-rw file contents to the new casper-rw partition.

sudo rsync -a /media/casper/ /media/cscameron/casper-rw/
  • Reboot

The original casper-rw file will become unused and may be deleted.

Similar proceedure should work for drives made using other bootdrive apps such as Rufus, a SDC drive can not be modified.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .