Score:1

Moving entire installation to a new hard drive

cn flag

This question is probably super common, but my situation might not be :) let's see.. I have a PC tower running as a home server using Ubuntu server 20.04 LTS (NAS, minecraft, etc random stuff). I want to upgrade my old system disk to a new one. Old one is a SATA SSD, 240GB. New disk is a 256GB M.2 NVME drive attached to the motherboard.

Ideally, I would like to just clone the whole drive since I would like to avoid reinstalling and reconfiguring. It seems Gparted can copy entire partitions so that would be the way to go. I tried it a couple of times using instructions I found here and there, but no luck. New drive just refuses to boot.

I think it might have something to do with my legacy drive. See, this drive used to be in a PC from the pre-UEFI era. My tower now has a new modern motherboard with all the new UEFI stuff, that I'm not really that familiar with. I simply moved the old drive to this new motherboard and it just happened to work, so I never bothered to fix the legacy stuff.

I think the issue might be here, I have booted using a live USB and noticed this mystical sda1 partition with something to do with grub (see screenshot). I'm quite familiar with Ubuntu, I have been using it since 2004. But when UEFI came to the picture, I was not really using it at that time and simply lost track on how UEFI and all the modern boot stuff works. Now the question is, how to properly migrate this setup to a new drive?

screenshot

EDIT: here is the gparted output in text form:

Partition filesystem flags

/dev/sda1 grub2 core.img bios_grub

/dev/sda2 ext4 (<--- the root filesystem)

sudodus avatar
jp flag
Are you sure that your computer can boot from the nvme drive? It is possible to boot Ubuntu in legacy mode from an nvme drive, if the computer can boot at all from that drive. But, for example, if you attach the nvme drive via a pci card to the mobo, it might not work. In that case you must have a boot partition (with `/boot`) in a drive, that the computer can boot from. Then in can continue booting into the root partition (`/`) in the fast nvme drive. -- I have a laptop that boot directly into the mvme drive and a tower workstation, that boots via another drive into the nvme drive.
oldfred avatar
cn flag
The bios_grub partition is required for grub on new gpt partitioned drives but using the very old BIOS boot. You say you do not want to reinstall, but it may be time to upgrade to UEFI/gpt? Best option always is to do new install & restore data from your normal backup. Proves backup is complete while you still have data on old drive. Drives do fail & then you need that back up anyway. If it takes more than an hour to reinstall & restore data, you do not have good backup & restore procedures.
cn flag
Thanks for the comments. I will check that the mobo can boot from NVME before going forward. Seems just obvious, since it's a modern MB, it's this one: https://www.asus.com/Motherboards-Components/Motherboards/PRIME/PRIME-B450M-K/ NVME drive is attached directly to the MB, no pci card madness in between :)
Anders F. U. Kiær avatar
in flag
"sudo dd if=/dev/sda of=/dev/nvme0n1" sda = sata drive, nvme0n1=nvme drive. to see the status of process open another terminal and do "watch -n 5 sudo pkill -usr1 ^dd". NB. this overwrites any data in the device given at of=, so be careful. after complete unplug old drive and reboot. if you keep both in your system will most likely be confused as you will have partitions with the same unique id's.
Score:1
fr flag
jmo

I did this with success! My old pc has SATA SSD dual boot system. LinuxMint. alongside Windows11. I added NVMe SSD. I want migrate system from SATA SSD to NVMe. This is how I completed the migration.

  1. Boot from Ubuntu liveUSB
  2. Use sudo fdisk -l to identify your source disk and target disk dev name.
  3. Use dd to clone the SATA to nvme with below command. e.g.
    sudo dd if=/dev/sda of=/dev/nvme0n1 bs=1M status=progress
  4. On target disk, modify /boot/grubbrb.cfg replace sda1 with nvme0n1p1 and save.
  5. Change pc firmware boot sequence, NVMe prior to SATA. Or simply unplug SATA drive.

Note: I use DD to clone disk that may causing flaw on partition table. But this can be fixed by run gParted.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.