14

After many unsuccessful trials based on almost everything about this topic on the Internet, I decided to ask this question again. There is almost a perfect answer in this platform, but it did not work. That's why I am here.

I want to have Ubuntu 18.04 installed on my USB memory stick (SanDisk Cruzer Glide 32GB) with a persistent storage of more than 4GB (at least 23GB in my case).

I used MiniTool partition wizard to format the stick (NTFS) on Windows. Then, I used Universal USB Installer 1.9.8.2 to install Ubuntu 18.04 on the stick. Here, I tried to format the stick either fat32 or ntfs, but nothing changed. Later, I used another Ubuntu to delete the casper-rw file and create another partition with the same name by following the steps given in the link given above. Unfortunately, I couldn't make it working although I tried almost all combinations.

Can anyone give a thorough list of steps to follow in order to install it on the stick properly?

Edit: I gave ear to @c-s-cameron 's comment below and used YUMI to do that, and it worked. I believe all other answers would work, but I dont have time to give a try for all of them. Thanks all, again!

  • 3
    Syslinux type installers like Universal, UNetbootin and Rufus do not allow persistent partitions on the same disk. You can put your casper-rw partition on a second disk if you like. YUMI will allow you unlimited casper-rw on NTFS, it is a Windows tool and uses grub4dos to make large casper-rw files. For a persistent drive I prefer mkusb, (a linux tool), it can be installed booting your 18.04 USB. – C.S.Cameron Jul 2 '18 at 15:54
  • 2
    mkusb does work well. The author is very active in Ask Ubuntu and quick to answer questions: askubuntu.com/questions/768970/… Haaa, I spent five minutes searching his profile for an answer he's posted, only to find out he's posted one below already :) – WinEunuuchs2Unix Jul 2 '18 at 17:25
  • Could you please add your comment as an answer? @C.S.Cameron ? – Samet Tonyalı Jul 3 '18 at 14:00
8

Syslinux type installers like Universal, UNetbootin and Rufus do not allow persistent partitions on the same disk.

It is possible to install a casper-rw partition on a second disk. It can be an internal drive or a flash drive or other USB device. The first casper-rw file or partition encountered while booting is used for persistence.

YUMI will allow you unlimited casper-rw file size on NTFS, it is a Windows app and uses grub4dos to make large casper-rw files. YUMI can make multiple Persistent installations on a USB drive. https://www.pendrivelinux.com/yumi-multiboot-usb-creator/

For a persistent drive I prefer mkusb, (a Linux app), it can be installed to your 18.04 USB. It uses a FAT32 partition for boot, a read only ISO9660 partition for the OS, a ext2 casper-rw partition for persistence and a NTFS data partition that can be used by Linux and Windows. A mkusb drive is easy to customize. https://help.ubuntu.com/community/mkusb

  • It appears that starting with 19.10 persistent partitions are again working on the same disk with syslinux type installs, UNetbootin, Rufus, etc. – C.S.Cameron Sep 3 at 20:00
12

**Full Install to USB - BIOS/UEFI **

Full installs have a few advantages over Persistent installs, more secure, faster boots, better file management, but do not work installing Ubuntu.

If you would like your USB drive to be able to boot from multiple computers, both BIOS and UEFI:

Use mkusb to make a Live system on the Installer USB (2GB or larger).

Use mkusb to make a Persistent system on the Target USB, 16GB or larger, using default settings with ~12GB persistence, (remaining NTFS partition is used as Windows accessible data partition).

enter image description here

Open GParted and delete sdx4, the ISO9660 partition and expand sdx5 into the recovered space, sdx being the device name of the Target drive.

enter image description here

Unplug or remove HDD before proceeding further, (optional but recommended, highly recommended in UEFI mode).

Boot Installer drive, select Try.

Insert Target drive

Start Install Ubuntu...

Select Something else.

Select sdx5, (on the target drive), and click Change.

enter image description here

Select Use as: ext4, Format and Mount point: /.

Don't touch any other partitions (unless adding a /home partition).

Select sdx5 for boot loader installation.

Complete installation.

Cut grub.cfg from sdx5/boot/grub and paste to sdx3/boot/grub, overwriting the existing grub.cfg file.

Boot the target drive and run sudo update-grub to add all drives to boot menu.

  • Drawbacks: you lose the compressed live media, which makes booting and running applications easily 4-5x slower on most USB sticks, and you also need a much larger USB stick since installing it takes up about 8x the space on the drive. Lastly, you lose the security of having an OS that's written in stone... but you lose a bit of that by enabling persistent state as well. – Wil Nov 18 at 19:37
  • @Wil : Today a Live install takes 2.5GB minimum with no persistence, a Full install starts at 8GB, "Full disk encryption" is possible with a Full install, not with persistent. see also: askubuntu.com/questions/156026/… – C.S.Cameron Nov 19 at 3:47
  • Yes, the OP required minimum 23GB of persistent storage, and didn't ask for encryption. sudodus' mkusb answer matches the OP's requirements exactly, and my comment was to inform users who follow your directions that they may experience poor performance compared to the other solution. Otherwise, yeah I have also recommended the same steps you did, but only on USB3.0 drives with >100MB/s read performance. The most painful performance comes from Firefox on a low IOPS thumb drive, where form operations can start taking dozens of seconds... ugh. – Wil Nov 23 at 5:50
  • @Wil I have spent time benchmarking Full install sticks vs Persistent sticks, For me booting was a little faster with Full install, no decompression required, Running speed was about the same if you have lots of RAM. Power Off requires the data to be recompressed, however results can vary. Note I have also recommended mkusb in another answer on this page. For me the deciding point is if I will be using the USB for installing Ubuntu or as a substitute for a HDD. – C.S.Cameron Nov 23 at 7:19
12

I suggest that you try mkusb. It can create a persistent live drive with a casper-rw partition almost automatically (it is an option in the graphical user interface).

  • The size of the casper-rw partition is only limited by the size of the USB drive (and the size of a 'competing' usbdata partition (for exchange of data with Windows) that you may give drive space). You can select 100% (of the remaining space, when the system files are installed) for persistence and use most of the drive space for the casper-rw partition.

If you run standard Ubuntu live, 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

Links

help.ubuntu.com/community/mkusb

help.ubuntu.com/community/mkusb/persistent

Quick start manual mkusb version 12 alias mkusb-dus

3

Rufus is able to create persistent live drives that work in both UEFI (MBR or GPT) and BIOS mode, with casper-rw being used for the persistent storage partition, so it can have a size of more than 4GB. Ubuntu Live ISOs created after August 1, 2019 support the persistent storage feature, so persistent partitions are only working with Rufus 3.7 and later using Ubuntu 19.10 and later.

Rufus persistent storage

  • New users: Please notice that persistence with a partition will work with Ubuntu 19.10 (and we hope also new future versions), but with Ubuntu 16.04.x, 18.04 - 18.04.3 and 19.04 it will not work at all. It will create a drive, that will not boot into a working system. In this case it is better to use the dd-mode of Rufus (and clone like what is done with the Ubuntu Startup Disk Creator). See this link. – sudodus Oct 5 at 6:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.