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?
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.
Install Ubuntu live on 2 USB drives. Configure a small persistent storage of around 100 MB for each of the USB drives.
Boot Ubuntu from one of the USB drives. Make sure the other USB drive is unplugged.
Start "GParted Partition Editor" from the Ubuntu Dash. This partition manager is default installed in 13.10.
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).
Check that the mount point (
/media/ubuntu/UUI
) is identical as in above picture.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):
Refresh GParted (Ctrl+R) and notice the change in "Used".
Right-click on the partition and select unmount. You will notice that the Mount Point is no longer displayed.
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
Now create a new partition for the persistent storage. Select the unallocated partition and right click on New.
Select file system “ext4“ and label
casper-rw
and click Add.Check if everything looks OK and click on the green check mark to apply all pending operations.
Shut down Ubuntu, remove the first USB drive (this USB drive is no longer needed) and reboot from the second USB drive.
Open a terminal (Ctrl+Alt+T) and type the following command:
Check that the Avail size matches with the persistent partition size you created.
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:
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:
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
is an alias for the latest updated new-look ofmkusb
. 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:
i
optionInstall(make a boot device)
p
optionPersistent Live
and select the .iso file.mkusb
decide what's best. (Or choose, but wisely.)Go
radio button and click Go.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:
Note the warning and click OK:
Double-Click on the i option Install(make a boot device):
Double-Click on the p option Persistent Live and select the .iso file:
Click on the USB drive to make persistent. I want to use my 32 GB one so I mark the radio button:
Click Use Defaults to let
mkusb
choose 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:
Double check very carefully and confirm. You don't want to mess up another drive.
If all goes well you will be greeted by a nice green finished screen:
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.
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.
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.)
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
If you do not have an official ubuntu (Lubuntu, Xubuntu, Kubuntu ...) ISO image download one.
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:
mkusb version 9-11:
when the password is requested enter the admin password
then in mkusb's main menu select the ISO image you have downloaded.
If you did not check it until now make sure that the bios settings allow booting from USB before HDD.
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.
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:
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
orext4
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).
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
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.
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.