Fedora USB persistence

I’m trying to create a persistent USB drive (external HDD) following this guide in the docs.

sudo livecd-iso-to-disk --home-size-mb 30000 --overlay-size-mb 100000 --format --reset-mbr Fedora-Workstation-Live-x86_64-36-1.5.iso /dev/sdb

I made some changes like the theme and indeed it’s persistent. The issue is that there is a localhost-live drive with 7.9GB in which all the programs and updates are installed. So there’s not enough space, despite running the --overlay-size-mb 100000 command.

I’m not aware of a way to tell how much space the overlay itself has left other than it will quit working once it is full.

The first thing I tried to install was GIMP flatpak but it couldn’t because there’s no space for it, so it’s somehow not recognizing the 100GB persistent overlay.

That command says to use an overlay that is 100GB. With a 7.9 GiB USB device it will never work.

1 Like

I’m guessing the drive itself is larger than that, but at some point the dd method was used to create the live-image so the filesystem is significantly smaller than the disk capacity. The disk will need reformatted (don’t forget to toggle the boot flag on!) to accommodate the overlay size with the live-image.

It’s external HDD(1TB).

The disk may have a capacity of 1TB, but the current filesystem the live image is running on only has 7.9GB, so the overlay is invalid. You’ll need to reformat the drive and then recreate the live-image/overlay in order to make use of the rest of the disk’s capacity. Note that reformatting the drive will effectively remove any data that’s on it. If you don’t want to do this, you can also try a more surgical approach to resizing the partition with GParted, which is also available in Fedora.

Thanks. You mean to reformat the whole drive with Gparted and delete all partitions created by livecd-iso-to-disk? What filesystem should I pick? (Also, I forgot to mention the main OS on the system is Windows)

Either are options. If you have unpartitioned free space on the drive, you might try seeing if you can just resize the partition/filesystem for the live image and see if it works. I haven’t done this in over a decade but I think the overlay is thin provisioned, so that might work without needing to re-image it.

Also, have you considered just installing Fedora on the external drive out-right instead of doing a live-image? Fedora is already highly portable, especially if you don’t need proprietary nvidia drivers. Just make sure to any deselect internal drives during installation so it installs the bootloader, etc., properly on the external drive and doesn’t impact your existing stuff.

You probably shouldn’t use --format, or at least you should give it an argument, when you want to set up an external hard drive with a liveCD image that uses an overlay or a persistent home.

Using --format tells the liveCD tool to partition the destination, and without an argument it will do so based on the amount of space it needs for the current files.

However, --format accepts an argument (a size in MB, like the other partition-sizing arguments), so livecd-iso-to-disk --format 100000 --home-size-mb 500000 --overlay-size-mb 400000 Fedora___.iso /dev/sdb would set up the stick with a 100GB filesystem (more than enough room to install anything), along with a 500GB /home/ and 400GB worth of overlay space to store changes to the static root partition.

But as @vwbusguy suggested, an installed Fedora is more robust, since the overlay system adds quite a bit of overhead and should be used sparingly, not as the installation target for lots of additional software. Using a persistent ISO image really isn’t meant for long-term, general use, even on a portable drive.

If you want an installed Fedora that still uses an immutable root partition, that’s called Fedora Silverblue.

See https://fedoraproject.org/wiki/LiveOS_image.
The 7.9 GB partition comes from the rootfs.img embedded in the squashfs.img that was copied during installation to the disk. The Device-mapper overlay cannot enlarge the size of that filesystem.

When installation of large software packages is expected or long-term usage of a LiveOS image is anticipated, an alternate overlay strategy is advised. If storage or memory resources are available, one may take advantage of the --overlayfs option to livecd-iso-to-disk. This option applies a specialized OverlayFS mount to the root filesystem, which allows one to escape from the limitation of the partition size of the embedded rootfs.img (see Booting Live Images).