How to Create Fedora Live Persistent USB

Creating Fedora Live USB With Persistence Overlay - techfirex

Requirements For Making Live USB With Persistence:

1.Linux OS (Ubuntu or Fedora itself)
2.16GB & Above Drive
3.Fedora ISO
4.Gparted
5.Livecd ISO To Disk Tool

Downloading Fedora:

You can download Fedora from below.
Get Fedora

Creating Fedora Live USB With Persistence Overlay:

The livecd-iso-to-disk method is slightly less reliable than Fedora Media Writer and can be used reliably only from within Fedora: 
it does not work in Windows or macOS and is not supported (and will usually fail) in non-Fedora distributions. 

However, it supports three advanced features which Fedora Media Writer does not include:

You may use a non-destructive method to create the stick, meaning existing files on the stick will not be destroyed. This is less reliable than the destructive write methods and should be used only if you have no stick you can afford to wipe.

On live images, you can include a feature called a persistent overlay, which allows changes made to persist across reboots. You can perform updates just like a regular installation to your hard disk, except that kernel updates require manual intervention and overlay space may be insufficient. Without a persistent overlay, the stick will return to a fresh state each time it is booted.

On live images, you can also have a separate area to store user account information and data such as documents and downloaded files, with optional encryption for security and peace of mind.

By combining these features, you can carry your computer with you in your pocket, booting it on nearly any system you find yourself using.

It is not a good idea to try and write a new Fedora release using the version of livecd-iso-to-disk in a much older Fedora release: it is best to only use a release a maximum of two versions older than the release you are trying to write.

As a Linux system, I'm using here Ubuntu OS.

Let's installing livecd iso to disk tool first.
Open terminal,
techfire@tushar:~$ sudo apt install cryptsetup-bin
techfire@tushar:~$ git clone https://github.com/livecd-tools/livecd-tools.git
techfire@tushar:~$ cd tools
techfire@tushar:~$ ls
After running ls command you will find livecd-iso-to-disk.sh script.

Now insert your pendrive in computer & if you are formatted it in FAT32, then I would suggest you reformat it in ext4 file system using Gparted software.

If necessary, you can have livecd-iso-to-disk re-partition and re-format the target stick:
techfire@tushar:~$ sudo ./livecd-iso-to-disk.sh --format --reset-mbr Fedora-Workstation-Live-x86_64-31-1.1.iso /dev/sdaX
Here I using /dev/sdaX means in your case X will change. For example /dev/sda1, /dev/sda2 etc
Sometimes it also shown as sdbX so keep this point in your mind and then processed

To include a persistent filesystem for /home, use the --home-size-mb parameter. For example:
techfire@tushar:~$ sudo ./livecd-iso-to-disk.sh --home-size-mb 12288 Fedora-Workstation-Live-x86_64-31-1.1.iso /dev/sdaX
This will create a 12GB(12288MB) filesystem that will be mounted as /home each time the stick is booted, allowing you to preserve data in /home across boots.

To enable 'data persistence' support - so changes you make to the entire live environment will persist across boots - add the --overlay-size-mb parameter to add a persistent data storage area to the target stick. For example:
techfire@tushar:~$ sudo ./livecd-iso-to-disk.sh --overlay-size-mb 9216 Fedora-Workstation-Live-x86_64-31-1.1.iso /dev/sdaX
Here, 9216 is the desired size (in megabytes) of the overlay. The livecd-iso-to-disk tool will not accept an overlay size value greater than 4095 for VFAT, but for ext[234] filesystems it is only limited by the available space.

You can combine --home-size-mb and --overlay-size-mb & --reset-mbr for making easy process, in which case data written to /home will not exhaust the persistent overlay:
techfire@tushar:~$ sudo ./livecd-iso-to-disk.sh --reset-mbr --noverify --overlay-size-mb 9216 --home-size-mb 12288 --unencrypted-home ~/Downloads/Fedora-Workstation-Live-x86_64-31-1.1.iso /dev/sdaX

Troubleshooting a live USB

livecd-iso-to-disk problems : 
Partition isn’t marked bootable
If you get the message Partition isn’t marked bootable! you need to mark the partition bootable. To do this,

run parted /dev/sdX,
and use the toggle N boot command,
where X is the appropriate letter,
and N is the partition number.

For example:

$ parted /dev/sdb
GNU Parted 1.8.6
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdX: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16

(parted) toggle 1 boot
(parted) print
Model: Imation Flash Drive (scsi)
Disk /dev/sdX: 1062MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 32.3kB 1062MB 1062MB primary fat16 boot

(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.