1

I currently have Ubuntu 16.04 installed on my E580 thinkpad's 240 SSD. I want to clone my installation to an external 1Tb HDD and then replace ubuntu with Windows 10 on the SSD. The reason is that I need to run the 3D CAD software SolidWorks (SW) which only runs on Windows. I've currently installed Windows 10 and SW on an external USB 3.0 1TB HDD, but the result is quite laggy.

Using fdisk -l I've found the SSD to be /dev/nvme0n1 and the new HDD to be /dev/sda . As described here I've already tried cloning the SSD to HDD by booting from a Ubuntu live CD and then using dd if=/dev/nvme0n1 of=/dev/sda bs=64K conv=noerror,sync, but upon booting from the HDD I get a the grub terminal. I'm fairly new at this so I'm unsure what to do next. Any help would be appreciated.

Phil
  • 13

3 Answers3

0

Disclaimer: I've taken the steps out of this manual to move Ubuntu to a f2fs partition.

First off I have a question: Did you run the dd from the active system or did you use a live booted system to clone your current installation?

I'd suggest the following steps:

  1. create the partitions you need on the new target drive
  2. copy your installation from an external booted live system with rsync to the new location
  3. bind a few folders and chroot into your new tatget copy
  4. update /etc/fstab for the new location
  5. install and update grub

1. Copy to new target
Boot from an Ubuntu installation disk and have a look with synaptics on your target drive and create your partitions if necessary.

Afterwards, open a bash, enter root shell and do:

cd /media
mkdir -p ubuntu ubuntu/oldRoot ubuntu/newRoot
cd ubuntu

Now check what your partitions are. For the example I choose the following:

  • /dev/sda1 - old Root
  • /dev/sdb1 - new Root

Mount them:

mount /dev/sda1 ./oldRoot
mount /dev/sda2 ./newRoot

2. Copy to new Location

rsync -avWHAX --progress ./oldRoot/* ./newRoot/

3. Chroot into new location

mount -o bind /dev ./newRoot/dev
mount -o bind /sys ./newRoot/sys
mount -o bind /proc ./newRoot/proc

chroot ./newRoot

4. Update fstab for new Location
Check the new UUID for your partition and replace the old one in /etc/fstab with it.

5. Install and update grub

I guess you have your SSD as first boot device atm. You have a choice here how to do it, read them below.
I'll show you the second way:

grub-install /dev/sdb
update-grub

exit
umount ./*

Now you should have your Ubuntu bootable from the new Location.

Grub Options:

  1. Do the grub install onto the ssd, verify your system boots fine from the new location, install Windows on the ssd (which most likely will remobe grub again) and rerun point 3-5 of my list. That way you'd have the same boot order.

  2. Do the grub install onto the HDD where your Ubuntu will live and do a update-grub after Windows is installed on the SSD. That way you'd have to change the boot order to the HDD, but it would make your system being able to function, even if remobe one of the disks. For Windows only you'd just have to change the boot order again and your Ubuntu is able to boot without the SSD.



side note to dd

dd is a low level tool, that just copys over the blocks like they are laying around. That means your target device must be at least as big as your source device. If you have a big partition, that's barely filled, you still would copy all the empty space from the source over. Using rsync for this task copied the files present to the other side and gives you the freedom of changing your partiton layout if you thought in the past there's something you'd like to change, that's the chance^^.

9Lukas5
  • 21
0

You can use this script: Bash script to clone Ubuntu to new partition for testing 18.04 LTS upgrade to clone Ubuntu 16.04 (or other distros and versions):

clone-ubuntu.png

0

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 in another post of AskUbuntu 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