You have some of your steps out of order and there are a few pieces missing here, but the general idea you have is good.
Firstly, yes, you will want to use a live USB to do the cloning. You should have every file on your root partition "at rest" (i.e., no program actively using it) while cloning things.
Next, you are right about first making an EFI partition and then a root partition. However, this will give you two EFI partitions, one on your old disk and one on the new one, which could cause confusion. We can deal with that part at the end.
The next step is not the grub-install step. Rather, this is when you want to do the cloning. From a live USB, you'll want to do something like this:
cd /mnt
mkdir source
mkdir dest
sudo mount /dev/sdXY ./source # this isn't guaranteed to be sdb1 anymore, so check it with lsblk first!
sudo mount /dev/sdAB ./dest
sudo cp -a ./source/. ./dest/. # the slashes and periods are important here
That last command will take a while to run, depending on how much it has to copy. This will copy over all of the files on your root partition to the new partition, preserving as much info as possible, including file permissions. (Do NOT use cp -r
here, it will mangle file permissions and you'll almost certainly get a broken clone. cp -a
is the way.)
Once that finishes, your clone is done, but you're not quite out of the woods yet. You still have to install the bootloader, but also, you will have to tweak /etc/fstab. This is the file that tells Linux what to mount and where to mount it during bootup. Usually /etc/fstab identifies your root partition via UUID, and your partition's UUID will be different than it used to be.
To figure out your partition's UUID, use lsblk -f
. This will display a bunch of partition info, including the UUIDs. Find the UUID of your destination drive, and copy it into a text file.
Next, run "sudo nano /mnt/dest/etc/fstab", and find the line that mounts your root partition (it will have a single /
as the mountpoint). Replace the UUID in this line with the UUID of the new partition that you found earlier. Then press Ctrl+S to save, and Ctrl+X to exit.
Now we can install the bootloader. Mount the new EFI partition using sudo mount /dev/sdAC /mnt/dest/boot/efi
(replacing AC
as appropriate). Then you should be able to install the bootloader with a command like this:
sudo grub-install --target x86_64-efi --efi-directory /mnt/dest/boot/efi --boot-directory /mnt/dest/boot
And lastly, generate the GRUB configuration:
sudo grub-mkconfig -o /mnt/dest/boot/grub/grub.cfg
With that complete, shut down the computer, disconnect the old drive to keep the old EFI partition from causing confusion, and then try and boot into the cloned installation. If you can boot successfully, you hopefully should be good to go!