Ubuntu usb persistent more than 4gb

The current Unix USB Installers (e.g. LinuxPenDrive) 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 Ubunty 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)

enter image description here

  • 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) :
    rm -v /media/ubuntu/UUI/casper-rw
  • 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

enter image description here

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

enter image description here

  • Shutdown 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:
    df . -h

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

enter image description here

Have fun with it

Leave a Reply