Migrate a Fedora 41 Portable Workstation

This post is intended for an audience steeped in the tradition of “Trust but VERIFY” encouraged by CCIE Chris Bryant. Belief in one’s ability to migrate an nth copy of Fedora to the same or a different SSD is but a dream until you have actually accomplished that goal. Migration is complex but consumes far less time than a fresh install coupled with significant customization.

Instructions presented here have enabled me to migrate portable Fedora 41 installations quickly and with no undesired side effects. Spoiler alert, they differ from instructions found in the “wild”. A tool providing Multiple UEFI ESP partitions, Linux Distros and bootable ISOs using one USB NVMe SSD is what I use to prepare for any Fedora migration. A link to how to create such a tool follows:

Multiple UEFI ESP partitions, Linux Distros and bootable ISOs using one USB NVMe SSD

A link to a post describing how to Install Fedora 41 as a Portable Workstation follows:

Install Fedora 41 as a Portable Workstation

Ensure that source Fedora “/boot/efi/” contains content of the associated UEFI system partition BEFORE starting a migration.

Create and LABEL a target UEFI system partition with a size of about 91 to 94 Mb. Note, additional UEFI partitions can be created Gbs after the first UEFI partition. I create each of these such that the size is one Mb larger than the previous one used for Fedora.

Create and LABEL a target partition for Fedora migration that is at least as large as the Fedora partition to be migrated.

A “dd” command can be used for migration but lacks the benefits of compression and encryption.

Before Fedora 39 was released, fsarchiver was preferred because it facilitates compression and encryption. Conflicts with “e2fsprogs” file system utilities cause “fsarchiver” to throw errors when an attempt is made to create an archive of a Fedora 39, Fedora 40 or Fedora 41 ext4 filesystem partition. This behaviour has been reported as “Red Hat Bugzilla – Bug 2323389 - Fsarchiver v8.5 ships with Fedora 40 but cannot archive and restore a Fedora 40 or Fedora 41 ext4 OS partition”.

Migrate the UNMOUNTED Fedora 41 partition “/dev/nvme0n1p8” to a target partition “/dev/sdb3” using the command “sudo date;dd bs=222M status=progress if=/dev/nvme0n1p8 of=/dev/sdb3;date”. Then use “gparted” to change the UUID on the target partition to a new random one. Right clicking on a partition will display a context menu with “New UUID” as an option.

Open a terminal window and execute the “lsblk -f” command to enable viewing of the updated UUID. Keep this window open because you will copy/paste that UUID several times.

Use VIM or an editor of your choice to effect UUID replacement using the new random UUID in the following files:

“/etc/fstab”
“UUID=<Original UUID> / ext4 defaults 0 2”

“/etc/kernel/cmdline”
“root=UUID=<Original UUID> ro”

“/boot/loader/entries/”
RESCUE file - title Fedora Linux (0-rescue-01ee60f708614f9d9ab6880e3b9dfd21) 40 (Cinnamon) often the last file.
"options root=UUID=<Original UUID> ro "

ALL “/boot/loader/entries/”
"options root=UUID=<Original UUID> ro "

Upcoming steps will cause file “/boot/grub2/grub.cfg” in the target partition to be replaced with an updated version. There are many ways to accomplish this task. I will present a method that reduces the probability of unexpected collateral damage.

While running a recent version of Fedora, but not the source or target versions of Fedora involved in this migration, mount the target OS partition.

Navigate to “/boot/efi/EFI/fedora” on the mounted partition. Execute the command "sudo grub2-mkconfig > “/tmp/temp.cfg” to create a temporary config file.

Use VIM or an editor of your choice to locate and replace the source Fedora UUID with the new random UUID in the following lines of file “/tmp/temp.cfg”:

search --no-floppy --fs-uuid --set=root <Original UUID>
search --no-floppy --fs-uuid --set=root <Original UUID>
search --no-floppy --fs-uuid --set=boot <Original UUID>
set kernelopts="root=UUID=<Original UUID> ro "

These lines will be found in approximately the first 160 lines of the temporary config file.

Copy the temporary config file to directory “/boot/grub/2” in the target Fedora partion. Rename the file “grub.cfg”.

Terminal window may be closed now.

Update the target UEFI system partition by copying content of directory “/boot/efi/” to the UEFI partition. Note. “/boot/efi/” should contain a copy of the orignal Fedora UEFI system partition.

1 Like