Easy way to clone Fedora

Hi guys. I have ssd and nvme storages and need to copy system from ssd to nvme. Partition: efi (grub) (fat32) root (ext4) How can i do it easiest?

2 Likes

Start the system by using a live-CD/USB.

Now lets assume the ssd is /dev/sdx and the nvme is /dev/sdy…

as root use:

dd if=/dev/sdx of=/dev/sdy bs=4M status=progress conv=fsync

This will get you a 1:1 copy. After that you can use gparted to adjust the partitions on the target device to your needs.

Edit:
Make sure to double-check the device-names since all data on the target-device will be lost!

Edit 2:

7 Likes

simple best! Have a nice day!!!

3 Likes

Have problem with boot. Grub wont load it.

You will have to be a little more precise. At what stage did the boot fail? Are there any error messages? Did you remove the old boot-device? You should have two identical devices and booting either one or the other should make no difference. Using both at the same time will most likely fail.

1 Like

Old partitions removed, have problem with dracut or switch root

Ok, so you get past the boot-menu and dracut fails when trying to find or mount the root device? This indicates either kernel modules missing in the initrd or a wrong UUID of the root-device. Without logs there will be no way to help you.

On the command line options for the kernel please check the UUID of the root-device, replace ‘rhgb quiet’ with ‘rd.shell rd.debug’ and please try to post a log along with the output of uname -r.

1 Like

Since you can’t boot the cloned system, you need to chroot into it. You can find a guide here: https://docs.fedoraproject.org/en-US/quick-docs/bootloading-with-grub2/#restoring-bootloader-using-live-disk

You need to adjust and rebuild your grub configuration to point to the cloned partitions. You can find useful information here
Working with the GRUB 2 Boot Loader :: Fedora Docs and here: GRUB 2 - Fedora Project Wiki

Switch root sound a lot like the Dracut Emergency shell. After chroot into your system, also rebuild the initramfs using dracut -f (see: InitRAMFS, Dracut, and the Dracut Emergency Shell - Fedora Magazine)

You also have to adjust /etc/fstab/ to correctly mount your volumes/partitions.

4 Likes

Since all UUID’s and the bootloader match the source when using dd to clone, the problem most likely is a missing kernel module for the nvme - and rebuilding the initrd via chroot the way to go :wink:

2 Likes

Thank for help, guys!

Old drive read speed is 550Mb/s for ssd, new - 1.5GB/s for nvme. I tried to copy system to a new drive. Restored original system state, cause could not normally boot system from new storage. Have no time for experiments now. Maybe simplest way is make clean installation to new drive.

You’re welcome!

One thing you could try prior to a new installation is

  • wipe the nvme
  • add it to your current system and boot from the ssd
  • if the system is up and running check that the nvme is accessible
  • run dracut -f to rebuild the initrd with the needed kernel modules
  • try to clone again

This time the initrd should match the nvme…

2 Likes

hmmm good idea, i did not do this after installation new drive. maybe it was cause of error during boot?

Thank you again, guys.

It’s amazing. I was make ‘dracute’ inside old system, than was boot LiveUSB Fedora 33 and make ‘dd copying’, old-drive-system was cloned and booted successfully from new storage without any magic actions ‘from-the-box’.

I think problem was in drivers after installing new device and was fixed by ‘dracute’.

2 Likes

In the F34 Test distribution, the components and disks were tested. As mentioned above, it works perfectly. Thanks for the good answers to the good questions.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.