2

So, I wanted to create a live Ubuntu USB but with the ability to save some files. However, I don't like the idea of persistence as it saves all 'changes'. Instead, here is what I wanted:

A USB with 3 partitions

- the first partition contains the live Ubuntu system
- the second partition will auto-mount on boot at the 'Desktop' directory of the live system
- the third partition will auto-mount at the 'Downloads' directory

In this way, I'd like to be able to save any downloads during the live run as well as any files created in the Desktop. Also, if the auto-mounting part is doable, can it be done in such a way that my live environment Desktop boots up to show all my files from the second partition, ie it would look like I have enabled some form of persistence?

The thing is, I had initially wanted a USB with a "Full install" of Ubuntu on it so I can carry around my entire workstation in my pocket. But that didn't quite work out due to the speed limitations of the USB(I think) and I figured this would be the next best thing. As for applications that I normally use everyday, I've decided to customize the Ubuntu ISO with 'Cubic' and pre-installed all the apps that I'd need.

UPDATE (output of lsblk -f after installing through mkusb):

n0pe
  • 121
  • 2
    I have used flash drives for emergency boot & backup. But happened to upgrade from SATA m2 drive to NVMe drive. And put M2 SATA in adapter. Bit larger than flash drive, but not as large as normal external drive. And almost as fast as internal SSD, faster than internal HDD. I thought part of why flash drives were slow was USB3 port, but not the case. Already have a lot of flash drives, so all new external drives will be SATA m.2 & adapters and now large enough for full install & most of my data. – oldfred Jun 02 '21 at 14:46

2 Answers2

2

I don't know how to get exactly what you want, It may be possible but difficult. But I can discuss alternatives and suggest something similar, that is easy to make and might be good enough for you.

  • I would use a 'normal' persistent live system for this task (made with mkusb version 12 alias mkusb-dus). It can do what you want to do, and if you are cautious, you can avoid storing unnesseary files and avoid unwanted settings.

  • A simple alternative would be to create a live drive with a data partition with mkusb-plug.

  • An intermediate alternative would be to create a live system with persistent home (but not a persistent root, so that new application programs and system tweaks will not be persistent). Only what is stored in the home directory will be stored, user specific tweaks, the content of Desktop, Documents, Downloads, etc.

    This is done by modifying a 'normal' persistent live system:

    • removing the content (directories and files, if any) of the partition for persistence with the label writable, and
    • changing the label of this partition to home-rw

If you wish, you can boot a [partially] persistent live system without the boot option persistent (that is boot it live-only) and delete unwanted data from the partition for persistence. The next time you boot persistent live, those files and/or corresponding settings will be gone. This way you can keep only the content of 'Desktop' and 'Downloads'.

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • I installed mkusb-plug and used it to install a live system with a FAT32 USBDATA partition (I selected 'l' in the prompt). The USB boots just fine but when I try to access USBDATA from the Ubuntu file manager, I get the following message, "Error mounting /dev/sda3 at /media/ubuntu/USBDATA: /dev/sda3 already mounted or mount point busy". What am I doing wrong here. I thought this would allow me to move files into USBDATA during the live boot and then access said files later from Windows, etc. – n0pe Jun 03 '21 at 17:30
  • @n00dles, Please run the command lsblk -f and edit your original question to show the output. Indent each line 4 spaces to render the output as code. This should help me see what is mounted and how it is mounted, and I hope, help you. – sudodus Jun 03 '21 at 18:19
  • Partition #3 should be mounted at /media/ubuntu/USBDATA automatically. Try (in a termanal window) to change directory cd /media/ubuntu/USBDATA and write and read files. (I tested in such systems based on 20.04.1 LTS and the current daily focal iso file (which will eventually become the next point release 20.04.3 LTS). So it should work for you too, at least with the LTS release. (However, mkusb-plug might have problems with the short-lived versions 20.10 and 21.04 and a data partition (but it should work there too in order to make a persistent live drive).) – sudodus Jun 03 '21 at 18:46
  • I forgot to upload it as code. Will this do, or would you prefer it as code? Also, I read the above message just after posting this one. I'll get back to you after checking those things out – n0pe Jun 03 '21 at 18:49
  • A picture is waste of drive space and internet bandwidth, so in the future, please upload text output as code. But I can see that your partition #3 is not mounted (and it should be automatically mounted). Please try sudo mkdir /mnt/sd3; sudo mount /dev/sdb3 /mnt/sd3 and cd /mnt/sd3 and try to write and read some file there. Using this method will probably mount the drive with root as owner, which makes things complicated. - But in order to debug the problem: Please tell me which version of Ubuntu you use: check with lsb_release -a – sudodus Jun 03 '21 at 18:58
  • If your system refuses to automount the data partition, you can change the owner (to the live system's regular user id) according to the instructions at this link. But this is not convenient, we should be able to make your system automount the data partition. – sudodus Jun 03 '21 at 19:07
  • I tried to mount /dev/sdb3 at /mnt/sd3 and got "mount: /mnt/sd3: /dev/sdb3 already mounted or mount point busy". Output of lsb_release -a: No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic – n0pe Jun 03 '21 at 19:17
2

More on mkusb

Try using a Persistent USB made using mkusb.

It has a read only ISO9660 OS partition, a Persistent "writable" partition and a NTFS Data partition. A Persistent home-rw partition is easy to add.

It also has a toram option so the Live OS will run in RAM, (which is many times faster than SSD). Xubuntu is a good choice for fast OS, it loves to run in RAM, so maybe try that.

A persistent USB made using mkusb can be reset by formatting the persistent partitions, or by deleting files in them.

The contents in a Persistent partition are not hidden away like the data in a Persistent file and there is no 4GB size limit.

C.S.Cameron
  • 19,519