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.

3 Answers 3

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

4
  • I've used the script and it went through all steps as described in your link. I've been able to boot into the clone from my laptop by selecting /dev/sda1 from the grub menu at startup. However, I tested on my desktop which has both Ubuntu and Win10, but could not boot from clone. The clone does not appear in the PCs grub menu. I also tried changing boot order to the external HDD where the clone lives, but this gave me just a flashing cursor. Any ideas?
    – Phil
    Jul 23, 2018 at 19:36
  • After plugging the external drive into your desktop and rebooting you'll need to run sudo update-grub Jul 23, 2018 at 19:54
  • Thank you, I realised I should do that based on @9Lukas5 's description below. The output is here drive.google.com/open?id=1yBOvYfh413_ayK3YVcyi0ZEq-5fyU9AJ Clone now appears in Grub, but upon booting from HDD the screen just goes purple. I've tried booting in recovery mode, but get the message that some /boot/vmlinuz file is missing. Any ideas? Seems I am close...
    – Phil
    Jul 23, 2018 at 20:59
  • Rather than screen shots, please highlight text in terminal and right-click and select "copy". Then edit your question, right-click and select "paste". This makes it easier to read than screen shots. In your external HDD you should see /boot directory and in there one ore more copies of vmlinuz, one for each kernel version installed on it. Include the output of cat /etc/fstab and sudo blkid into your question. Just to confirm you can access external HDD from laptop ok? Jul 24, 2018 at 0:46
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^^.

5
  • Thank you! Will try this and report back. As to your question, I booted from a Ubuntu live CD and ran the dd in this.
    – Phil
    Jul 19, 2018 at 8:37
  • I'm getting stuck at step 2. The process initiates, but then doesn't proceed after a certain point. Here is the last line of the terminal output where it gets stuck home/philipp/.cache/mozilla/firefox/vyymox6h.default/cache2/entries/000AA1A30418F82A105DCC36E2C77023D92176B8 32,768 30% 193.94kB/s 0:00:00
    – Phil
    Jul 19, 2018 at 13:56
  • Hmm, you could try to only use -av --progress as rsync params. ` ` But first have a look into dmesg if you see any I/O errors
    – 9Lukas5
    Jul 19, 2018 at 16:14
  • @Phil did you get it working?
    – 9Lukas5
    Jul 22, 2018 at 16:51
  • 9Lukas5 I ended up using the script which @WinEunuuchs2Unix suggested. Sorry for not getting back to you, didn't get around to retrying the clone for a few days.
    – Phil
    Jul 23, 2018 at 19:33
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .