1

I had ubuntu 20.04 installed on my HDD and i copied it to my new partition (/dev/sdb4) on SSD, then i installed grub. Now whenever i select ubuntu on /dev/sdb4 (i.e. ubuntu on SSD) boot option, my system boots from HDD ubuntu instead of SSD ubuntu. How to fix this?

enter image description here

Refer to this for more info on how i copied ubuntu from HDD to SDD:- How to transfer ubuntu 20.10 from HDD to SSD, i already have windows 10 installed on SSD

1 Answer 1

0

In /boot/efi/EFI/ubuntu/grub.cfg, there is a filesystem UUID referencing whatever partition contains the /boot directory/filesystem. This is used by GRUB to find the real /boot/grub/grub.cfg, which contains further UUID-based references to the Ubuntu filesystem.

When you copied the Ubuntu partition to the SSD, it also copied the filesystem UUID. So you have two filesystems with the same UUID, and when searching for that UUID, GRUB happens to look at the HDD first.

If you no longer need the copy on the HDD, you should change the UUID of the copy on the HDD so it will no longer match what GRUB is looking for. The command to change the filesystem UUID is specific to each filesystem type: see this question for the appropriate commands for several filesystem types.

Alternatively, you could change the UUID of the Ubuntu filesystem on the SSD instead, and then replace all the references to that UUID with the new UUID on the SSD-based installation. You would have to edit at least /boot/efi/EFI/ubuntu/grub.cfg, /boot/grub/grub.cfg, /etc/fstab and possibly also /etc/initramfs-tools/conf.d/resume, then regenerate your initramfs file on the SSD. This is more work, but by keeping the original unchanged on the HDD you will be able to try the copying again if you make a bad mistake.

2
  • If UEFI boot with gpt partitions, there also are GUIDs that cannot match. GUIDs are shown as partUUID in many tools. Check for all duplicates: lsblk -o name,mountpoint,label,size,fstype,uuid,partuuid | egrep -v "^loop" As I posted in your link, I did new install in about 10 min to SSD, copied /home so I had my settings. I do have all data in another data partition, so I only had to set those links up. About an hour for a full working install that was at least 90% of install on HDD. Installing apps from list would add a bit, but I had not installed much in my test install on HDD.
    – oldfred
    Aug 10, 2020 at 14:36
  • I was using this info: Do not use dd to copy partition with gpt due to unique guids & UUIDs post #12 (author of gdisk) ubuntuforums.org/showthread.php?t=1680929 Do not use dd with gpt partitions. Whole drive ok if old drive not used anymore, or no duplicates. But do not use dd for copies from MBR to gpt partitioned drives, can use cp -a wiki.archlinux.org/index.php/Disk_Cloning
    – oldfred
    Aug 10, 2020 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.