0

I have a Ubuntu box which is currently running on an old 500GB HDD.

As I got hold of a 240GB SSD and the HDD was only used partially (10% used) I decided to clone the HDD to the SSD.

Since the HDD is larger then the SSD, I defragmented it and resized its data partition to a size under 240GB. After this the system is still working and boots up as usual.

Here is the new HDD geometry as reported by gparted.

Since the SSD was on a 100% Windows machine it had a MBR partition table which I replaced with a gpt partition table. I then created two partitions of the same size as the ones present in the HDD.

Here is the SDD geometry as reported by gparted.

I then started the PC using another Ubuntu bootable USB and issued these two dd commands:

sudo dd if=/dev/sda1 of=/dev/sdd1 status=progress
sudo dd if=/dev/sda2 of=/dev/sdd2 status=progress

All went fine without errors but at the end of it the PC refuses to boot from the SDD.

Partition /dev/sdd2 seems to have been correctly cloned since I can mount it when I either boot from /dev/sda or from the bootable USB. But I notice that the used space in /dev/sda2 is larger then the used space in /dev/sdd2. I suspect this is due to any temporary files and devices resulting from booting from it.

I tried to boot from the SSD without any other disks connected but all I get is that when the PC is booting it goes straight into the BIOS/EFI menu.

Any idea why my SSD refuses to start?

Fabricio
  • 101
  • Thanks @mook765 but isn’t the dd of /dev/sda1 to /dev/sdd1 supposed to copy the boot partition as it is right now? – Fabricio Feb 22 '22 at 20:24
  • 1
    The MBR is not a partition at all, you need to install an instance of grub into the MBR of the new drive to make the drive bootable in legacy mode. – mook765 Feb 22 '22 at 20:28
  • Thanks! I’ll look into that. – Fabricio Feb 22 '22 at 20:29
  • 5
  • 4
    When you clone just a partition with dd, only the partition gets cloned. The bootloader does not get cloned. You can clone the full disc and then truncate the results to put them on a smaller drive, See: https://askubuntu.com/a/1300542/43926 – C.S.Cameron Feb 23 '22 at 01:01
  • 1
    or At this point it is probably easiest to just reinstall GRUB. booted in BIOS mode run: sudo mount /dev/sdx3 /mnt
    sudo grub-install --boot-directory=/mnt/boot /dev/sdx
    – C.S.Cameron Feb 23 '22 at 01:36
  • grub-install was giving me a funky error so I ended up using boot-repair: https://help.ubuntu.com/community/Boot-Repair – Fabricio Feb 23 '22 at 18:53
  • 1
    @Fabricio It sounds like you resolved this. If so, please add your solution as an answer and mark it accepted so that this gets closed out. Thanks! – NotTheDr01ds Mar 09 '22 at 15:33

2 Answers2

1

I recently faced an Ubuntu no boot issue after cloning my dual boot (Windows 10 + Ubuntu 20.04) from my HDD to a new M.2 NVMe SSD. Windows was booting fine but Ubuntu was just showing the Grub shell.

As recommended here and in some other forums too I used the Ubuntu Boot-Info tool which showed the issue was, during cloning GRUB was installed in partition1 instead of partition7 where my Ubuntu installation was. So I used Ubuntu Boot-Repair tool which reinstalled GRUB in the correct partition and voila! My Ubuntu was back in business and Grub loaded working as before

Boot-Info :

Boot-Repair screenshot

0

Copying individual partitions was necessary to clone the original disk since the target disk was smaller than the original one. However following a couple of comments I eventually realized that copying individual partitions wouldn't copy the boot record.

To resolve this issue I eventually used the application Boot-Repair (help.ubuntu.com/community/Boot-Repair)

Fabricio
  • 101