1

My current system set up is as follows:

System: Host: Ubuntu 20.10 Kernel: 5.8.0-33-generic x86_64 bits: 64 Desktop: N/A Distro: Ubuntu 20.10 (Groovy Gorilla)

Machine: Type: Desktop Mobo: ASUSTeK model: M5A78L-M PLUS/USB3 v: Rev X.0x serial: <superuser/root required>

BIOS: American Megatrends v: 0502 date: 11/18/2016

CPU: Info: 6-Core model: AMD FX-6300 bits: 64 type: MCP L2 cache: 2048 KiB Speed: 1406 MHz min/max: 1400/3500 MHz Core speeds (MHz): 1: 1405 2: 1405 3: 1406 4: 1406 5: 1406 6: 1396

Graphics: Device-1: NVIDIA TU117 [GeForce GTX 1650] driver: nvidia v: 455.38 Display: x11 server: X.Org 1.20.9 driver: nvidia unloaded: fbdev,modesetting,nouveau,vesa resolution: 1920x1080~60Hz OpenGL: renderer: GeForce GTX 1650/PCIe/SSE2 v: 4.6.0 NVIDIA 455.38

Audio: Device-1: Advanced Micro Devices [AMD/ATI] SBx00 Azalia driver: snd_hda_intel Device-2: NVIDIA driver: snd_hda_intel Device-3: JMTek LLC. type: USB driver: hid-generic,snd-usb-audio,usbhid Sound Server: ALSA v: k5.8.0-33-generic

Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 IF: enp4s0 state: up speed: 100 Mbps duplex: full mac: 2c:4d:54:e9:5b:9d

**Drives: Local Storage: total: 689.34 GiB used: 51.90 GiB (7.5%) ID-1: /dev/sda vendor: Western Digital model: WDS240G2G0A-00JH30 size: 223.58 GiB ID-2: /dev/sdb vendor: Western Digital model: WD5000AZRX-00L4HB0 size: 465.76 GiB

Partition: ID-1: / size: 95.07 GiB used: 51.90 GiB (54.6%) fs: ext4 dev: /dev/sdb5 Swap: ID-1: swap-1 type: file size: 2.00 GiB used: 0 KiB (0.0%) file: /swapfile**

Sensors: System Temperatures: cpu: 31.0 C mobo: 30.0 C gpu: nvidia temp: 27 C Fan Speeds (RPM): cpu: 2096 case-1: 0 gpu: nvidia fan: 50% Info: Processes: 313 Uptime: 2h 01m Memory: 15.62 GiB used: 3.16 GiB (20.2%) Shell: Bash inxi: 3.1.07

Screenshots of the drives - sda and sdb - from Gparted are shown below: Screenshots of the drives - sda

Screenshots of the drives - sdb

The first drive - sda (a 240 GB WD Green SSD) has Windows 10 installed in it. The second drive - sdb (a 500 GB WD HDD) has an NTFS partition with about 370 Gb allocated, then 512 MB ESP Partition which I had to create when installing Ubuntu 20.10, and the rest about 98 GB is ext4 with Ubuntu 20.10 installed. The GRUB is installed in sdb (it would not install on sda when I was installing Ubuntu 20.10)

I have a new 480 GB SSD drive on which I want to transfer / copy / the Ubuntu system which is currently on sdb5 (along with the ESP partition if required). Then I would remove the 500 GB HDD from the system and use it as an external drive, so my future system would have - (1) sda - 240 GB SSD with Windows 10 and (2) sdb - 480 GB SSD with the current Ubuntu system installed in it.

What is the best / easiest way to go about it? I'm not a system expert or anything, just an ordinary user who can install Ubuntu along with Windows and enjoy computing and coding on Ubuntu. Thank you in advance.

Tejas Lotlikar
  • 2,945
  • 5
  • 17
  • 26
surya_hs
  • 197
  • 1
  • 13
  • I would use sudo dd if=/dev/sdb of=/dev/sdc run from a Live USB, however 480GB might be too small to clone 500GB to, and a typo can overwrite the wrong drive. A safer method might be to use Disks to make a cloned image of the drive. This would require a spare 500GB drive to put it on. The Disks image file can probably be truncated to fit. Others swear by Clonezilla which would probably work with your size constraints.. – C.S.Cameron Dec 13 '20 at 05:38
  • @C.S.Cameron: I don't want to clone the whole sdb drive to a new 480 GB SSD, but only the ESP Partition and the 98 GB ext4 partition which has Ubuntu installed in it. I did check out Clonezilla but I don't really understand much of how it can work in this situation. – surya_hs Dec 13 '20 at 07:46

1 Answers1

1

Clone a Ubuntu OS Partition from a Dual Drive Dual Boot set up to new SSD

  • Preferably unplug your Windows drive sda, (you can't break what is not there).

  • Plug in your new 480GB SSD

  • Boot a Live or Persistent Ubuntu USB, (made using Rufus, Etcher, mkusb, etc).

  • Open GParted, Create a partition table on the new drive of the same type, msdos or gpt, as the old Ubuntu drive.

  • Select the EFI partition you want to clone, right click and select Copy.

  • Select the SSD, right click and select Paste. Locate the partition on the left side.

  • Repeat with the 97GB OS partition. You can make it larger if you wish

  • Apply All Operations

  • Install Grub. Assuming sdx1 is the esp partition, I use:

    sudo mount /dev/sdx1 /mnt
    sudo grub-install --boot-directory=/mnt/boot /dev/sdx
    
  • When done unplug the HDD to test the new drive. Note that the old set root='hd0,msdos5' in your grub.cfg file should be changed to set root='hd0,msdos2'. Also note that the HDD and SSD now have duplicate partitions with Duplicate UUID's. If you wish to keep the HDD as backup you can use GParted to change the UUID's.

  • Plug in the Windows drive, boot the Ubuntu drive and run:

    Sudo update-grub
    

to add Windows to the new boot menu.

C.S.Cameron
  • 19,519
  • Thank you very much, this worked almost perfectly. Only thing is when I booted from the new 480 GB SSD, the system booted into the grub> prompt.

    Then I followed the tutorial given in https://askubuntu.com/questions/883992/stuck-at-grub-command-line and it helped me to boot into Ubuntu 20.10 and I have a working system. Thanks again

    – surya_hs Dec 14 '20 at 14:08
  • Ah Yes, I guess I should have asked you to change (hd0,5) to (hd0,2) in grub.cfg. My apologies. If you confirm I will edit the answer to save others the problem of solving it. Thank you. – C.S.Cameron Dec 14 '20 at 14:38
  • Just a small update: Next time I rebooted the system, it again booted into the grub console. So then I went ahead and booted from a Ubuntu Live USB, installed Boot Repair tool (https://help.ubuntu.com/community/Boot-Repair) and used the "Recommended repair" option and the system booted up, but didn't show the Ubuntu menu. I haven't yet connected the 240 GB SSD with Windows 10 or the 500 GB HDD with the system, so hopefully when I connect them later, I can run "sudo update-grub" so that Windows 10 shows up in the menu. Thanks – surya_hs Dec 14 '20 at 14:47
  • I just checked "grub.cfg" in the working system and it shows lines like:

    menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-039e6328-2dcf-4e6c-87c7-405d3f1fd584' { recordfail load_video gfxmode $linux_gfx_mode insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_msdos insmod ext2 set root='hd0,msdos2' ...

    – surya_hs Dec 14 '20 at 14:54
  • Yes set root='hd0,msdos2' is correct. There are about four places in the menuentry where set root='hd0,msdos5' should be changed to set root='hd0,msdos2' if the OS has a GPT partition then set root='hd0,gpt2' would be used. When hd0 does not work try hd1, hd2, etc. – C.S.Cameron Dec 15 '20 at 03:16