I’m trying to migrate my data from a M.2 SATA SSD on an Intel laptop to a M.2 NVME SSD on an AMD Ryzen laptop. My System is dual-boot and I’ve cloned the whole drive using Macrium Reflect and of course I couldn’t boot into Linux on the new PC. I’ve checked the UUID and the MOUNTPOINT of my original and cloned SSD using lsblk and blkid.
On my M.2 SATA SSD
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 27M 1 loop /var/lib/snapd/snap/snapd/6953
loop1 7:1 0 54,9M 1 loop /var/lib/snapd/snap/core18/1705
sda 8:0 0 1,8T 0 disk
├─sda1 8:1 0 16M 0 part
└─sda2 8:2 0 1,8T 0 part
sdb 8:16 0 931,5G 0 disk
├─sdb1 8:17 0 1G 0 part /boot/efi
├─sdb2 8:18 0 16M 0 part
├─sdb3 8:19 0 463G 0 part
├─sdb4 8:20 0 1,5G 0 part
├─sdb5 8:21 0 1G 0 part
├─sdb6 8:22 0 1G 0 part /boot
└─sdb7 8:23 0 464G 0 part
├─fedora_localhost--live-root 253:0 0 195,3G 0 lvm /
├─fedora_localhost--live-swap 253:1 0 4G 0 lvm [SWAP]
└─fedora_localhost--live-home 253:2 0 264,7G 0 lvm /home
zram0 252:0 0 4G 0 disk [SWAP]
# blkid
/dev/sda1: PARTLABEL="Microsoft reserved partition" PARTUUID="4f119cef-bbad-44da-bd65-9ae5d436c546"
/dev/sda2: LABEL="Volume" BLOCK_SIZE="512" UUID="AC60EE5860EE28B2" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="9b0e7b05-5ddf-48bc-935d-f2143824cf57"
/dev/sdb1: UUID="F8F8-1956" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="a46d83c6-5d2e-40de-9beb-300f6103ad08"
/dev/sdb2: PARTLABEL="Microsoft reserved partition" PARTUUID="b456cf9a-1dac-49c4-b0e0-ae0fb8495ef3"
/dev/sdb3: BLOCK_SIZE="512" UUID="A48EF73A8EF70418" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="367399a3-5303-41ea-96b5-96bfd88aa24d"
/dev/sdb4: BLOCK_SIZE="512" UUID="8A64016C64015C77" TYPE="ntfs" PARTUUID="b6b2a71e-38a6-435e-9cf7-cfb1b6adf5c3"
/dev/sdb5: BLOCK_SIZE="512" UUID="1248167B48165DB3" TYPE="ntfs" PARTUUID="c16e7802-039c-4ae3-8959-8984db82babe"
/dev/sdb6: UUID="122be45f-1719-4f9f-a9c0-d718ddcc3084" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9aff7965-db83-44a4-9762-49ff2584a2db"
/dev/sdb7: UUID="3rkHxT-5J7o-xrxc-E9Ye-leZT-1rii-oqdcpB" TYPE="LVM2_member" PARTUUID="cfae24b7-47aa-4383-9b14-a10110dd9278"
/dev/mapper/fedora_localhost--live-root: UUID="a4100f89-dccd-4cd6-a020-e00e31d6ffe0" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/fedora_localhost--live-swap: UUID="7c7be751-30e6-485a-b3ad-95061e8b94ef" TYPE="swap"
/dev/zram0: UUID="0ec89041-a701-4478-ac6b-0c438860edba" TYPE="swap"
/dev/mapper/fedora_localhost--live-home: UUID="c08ec974-9a58-44e5-affc-115982e7b101" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
On my cloned M.2 NVME SSD. The 14.9G partitions belong to my live boot USB
[root@localhost-live liveuser]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1.7G 1 loop
loop1 7:1 0 6.3G 1 loop
├─live-rw 253:3 0 6.3G 0 dm /
└─live-base 253:4 0 6.3G 1 dm
loop2 7:2 0 32G 0 loop
└─live-rw 253:3 0 6.3G 0 dm /
sda 8:0 1 14.9G 0 disk
└─sda1 8:1 1 14.9G 0 part /run/initramfs/live
zram0 252:0 0 4G 0 disk [SWAP]
nvme0n1 259:0 0 1.9T 0 disk
├─nvme0n1p1 259:1 0 1G 0 part
├─nvme0n1p2 259:2 0 16M 0 part
├─nvme0n1p3 259:3 0 463G 0 part
├─nvme0n1p4 259:4 0 1.5G 0 part
├─nvme0n1p5 259:5 0 1G 0 part
├─nvme0n1p6 259:6 0 1G 0 part
└─nvme0n1p7 259:7 0 464G 0 part
├─fedora_localhost--live-root 253:0 0 195.3G 0 lvm
├─fedora_localhost--live-home 253:1 0 264.7G 0 lvm
└─fedora_localhost--live-swap 253:2 0 4G 0 lvm
[root@localhost-live liveuser]# blkid
/dev/sda1: LABEL="FEDORA-KDE-" UUID="149C-AD01" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="0019ca3b-01"
/dev/nvme0n1p1: UUID="F8F8-1956" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="026667fe-fabe-49fe-8b96-2b2930d1e471"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="d0993bf9-cfa2-4a01-b808-eaf14862de14"
/dev/nvme0n1p3: BLOCK_SIZE="512" UUID="A48EF73A8EF70418" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="6161d3db-1b78-4916-9781-dc3e601f9f12"
/dev/nvme0n1p4: BLOCK_SIZE="512" UUID="8A64016C64015C77" TYPE="ntfs" PARTUUID="a529fdfe-f28f-415e-9dee-9c7e83b03d40"
/dev/nvme0n1p5: BLOCK_SIZE="512" UUID="1248167B48165DB3" TYPE="ntfs" PARTUUID="992bec88-ca53-43ca-80e9-5673f380d0ca"
/dev/nvme0n1p6: UUID="122be45f-1719-4f9f-a9c0-d718ddcc3084" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="aa8b8d96-cdd8-4466-8074-9101d6536fda"
/dev/nvme0n1p7: UUID="3rkHxT-5J7o-xrxc-E9Ye-leZT-1rii-oqdcpB" TYPE="LVM2_member" PARTUUID="27a79a9e-55dd-47b4-91f6-cc4736e508fd"
/dev/mapper/fedora_localhost--live-root: UUID="a4100f89-dccd-4cd6-a020-e00e31d6ffe0" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/fedora_localhost--live-home: UUID="c08ec974-9a58-44e5-affc-115982e7b101" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/fedora_localhost--live-swap: UUID="7c7be751-30e6-485a-b3ad-95061e8b94ef" TYPE="swap"
/dev/loop0: TYPE="squashfs"
/dev/loop1: LABEL="Anaconda" UUID="466cfbf2-ca31-4b36-82e0-f765c897c473" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/live-rw: LABEL="Anaconda" UUID="466cfbf2-ca31-4b36-82e0-f765c897c473" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/live-base: LABEL="Anaconda" UUID="466cfbf2-ca31-4b36-82e0-f765c897c473" BLOCK_SIZE="4096" TYPE="ext4"
/dev/zram0: UUID="23ee2914-8717-4ff6-a871-8d3ceb76edec" TYPE="swap"
Those are my steps to try and fix my GRUB on the cloned M.2 NVME SSD. I’ve used a Fedora 33 Live CD and ran sudo -s
in the shell for root:
- Make a mount point
mkdir /mnt/fedora
- Mount the necessary partitions
mount /dev/mapper/fedora_localhost--live-root /mnt/fedora/
mount /dev/nvme0n1p6 /mnt/fedora/boot
mount /dev/nvme0n1p1 /mnt/fedora/boot/efi
mount -o bind /dev /mnt/fedora/dev
mount -o bind /proc /mnt/fedora/proc
mount -o bind /sys /mnt/fedora/sys
mount -o bind /run /mnt/fedora/run
mount -o bind /sys/firmware/efi/efivars /mnt/fedora/sys/firmware/efi/efivars
- Boot into the mounted partition
chroot /mnt/fedora
- Reinstall the needed packages
dnf reinstall grub2-efi-x64-modules
dnf reinstall grub2-efi grub2-pc grub2-pc-modules grub2-tools-efi grub2-tools-extra grub2-efi-x64 shim
- Use Grub2 Install
grub2-install --efi-directory=/boot/efi --target=x86_64-efi /dev/nvme0n1
This results in
Installing for x86_64-efi platform.
Installation finished. No error reported.
- EFI and grub2-install don’t work well with each other so reinstall grub2-efi and then use grub2-mkconfig
dnf reinstall grub2-efi
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
This results in
Generating grub configuration file …
File descriptor 3 (pipe:[120243]) leaked on vgs invocation. Parent PID 34706: grub2-probe
File descriptor 9 (pipe:[120263]) leaked on vgs invocation. Parent PID 34706: grub2-probe
File descriptor 3 (pipe:[120243]) leaked on vgs invocation. Parent PID 34706: grub2-probe
File descriptor 9 (pipe:[120263]) leaked on vgs invocation. Parent PID 34706: grub2-probe
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
Additional Info
- My /boot/efi/EFI/fedora/grub.cfg on my old M.2 SATA SSD has those entries
...
...
### BEGIN /etc/grub.d/10_linux ###
insmod part_gpt
insmod ext2
set root='hd1,gpt6'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt6 --hint-efi=hd1,gpt6 --hint-baremetal=ahci1,gpt6 122be45f-1719-4f9f-a9c0-d718ddcc3084
else
search --no-floppy --fs-uuid --set=root 122be45f-1719-4f9f-a9c0-d718ddcc3084
fi
insmod part_gpt
insmod fat
set boot='hd1,gpt1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=boot --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1 F8F8-1956
else
search --no-floppy --fs-uuid --set=boot F8F8-1956
fi
# This section was generated by a script. Do not modify the generated file - all changes
# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
#
# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
# populates the boot menu. Please refer to the Boot Loader Specification documentation
# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
set default_kernelopts="root=/dev/mapper/fedora_localhost--live-root ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet "
insmod blscfg
blscfg
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/10_reset_boot_success ###
insmod increment
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
set menu_hide_ok=1
else
set menu_hide_ok=0
fi
# Reset boot_indeterminate after a successful boot, increment otherwise
if [ "${boot_success}" = "1" ] ; then
set boot_indeterminate=0
else
increment boot_indeterminate
fi
# Reset boot_success for current boot
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###
...
...
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/sdb1)' --class windows --class os $menuentry_id_option 'osprober-efi-F8F8-1956' {
insmod part_gpt
insmod fat
set root='hd1,gpt1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt1 --hint-efi=hd1,gpt1 --hint-baremetal=ahci1,gpt1 F8F8-1956
else
search --no-floppy --fs-uuid --set=root F8F8-1956
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
# Other OS found, undo autohiding of menu unless menu_auto_hide=2
if [ "${orig_timeout_style}" -a "${menu_auto_hide}" != "2" ]; then
set timeout_style=${orig_timeout_style}
set timeout=${orig_timeout}
fi
### END /etc/grub.d/30_os-prober ###
...
...
- My newly created /boot/efi/EFI/fedora/grub.cfg with the steps above on my new M.2 NVME SSD has those entries
...
...
### BEGIN /etc/grub.d/10_linux ###
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 122be45f-1719-4f9f-a9c0-d718ddcc3084
else
search --no-floppy --fs-uuid --set=root 122be45f-1719-4f9f-a9c0-d718ddcc3084
fi
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=boot F8F8-1956
else
search --no-floppy --fs-uuid --set=boot F8F8-1956
fi
# This section was generated by a script. Do not modify the generated file - all changes
# will be lost the next time file is regenerated. Instead edit the BootLoaderSpec files.
#
# The blscfg command parses the BootLoaderSpec files stored in /boot/loader/entries and
# populates the boot menu. Please refer to the Boot Loader Specification documentation
# for the files format: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/.
# The kernelopts variable should be defined in the grubenv file. But to ensure that menu
# entries populated from BootLoaderSpec files that use this variable work correctly even
# without a grubenv file, define a fallback kernelopts variable if this has not been set.
#
# The kernelopts variable in the grubenv file can be modified using the grubby tool or by
# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX
# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both
# the kernelopts variable in the grubenv file and the fallback kernelopts variable.
if [ -z "${kernelopts}" ]; then
set kernelopts="root=/dev/mapper/fedora_localhost--live-root ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet "
fi
insmod blscfg
blscfg
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/10_reset_boot_success ###
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
set menu_hide_ok=1
else
set menu_hide_ok=0
fi
# Reset boot_indeterminate after a successful boot
if [ "${boot_success}" = "1" ] ; then
set boot_indeterminate=0
# Avoid boot_indeterminate causing the menu to be hidden more then once
elif [ "${boot_indeterminate}" = "1" ]; then
set boot_indeterminate=2
fi
# Reset boot_success for current boot
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###
...
...
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-F8F8-1956' {
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root F8F8-1956
else
search --no-floppy --fs-uuid --set=root F8F8-1956
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
# Other OS found, undo autohiding of menu unless menu_auto_hide=2
if [ "${orig_timeout_style}" -a "${menu_auto_hide}" != "2" ]; then
set timeout_style=${orig_timeout_style}
set timeout=${orig_timeout}
fi
### END /etc/grub.d/30_os-prober ###
...
...
Rebooting The PC
I have a boot menu. The Windows boot manager partition has changed after the process above from (on /dev/sdb1) to (on /dev/nvme0n1p1). After selecting Fedora in the boot menu I get this output about some minutes later After pressing Contorl-D
Now it’s stuck on this screen forever so there is still something wrong and I need help here. I guess that I’ve missed some important steps while fixing my GRUB in the steps above.