0

I know clonezilla would work if I was moving to a clean drive, but that's NOT what I want to do.

The reason I'm having a problem is simple: I installed Ubuntu and told it to "Install alongside windows" to make my life faster. In fact it ignored all the 50GB of unallocated space in Drive 1Drive one after install and instead installed Ubuntu to drive 2: drive 2

I mean, I won't even rant about this. I'm just super frustrated because I need both on the same drive and reinstalling would consume a lot of time, since I already spent hours to set it up, all programs, everything.

any ideas?

  • AFAIK, there is no way but to reinstall (and choose something else to tell the installer precisely where to install Ubuntu). However, you can backup the list of installed programs and restore them. https://askubuntu.com/q/9135/124466 – Archisman Panigrahi May 20 '21 at 13:56
  • I still suggest new install & restore from normal backup. Then you know your backup includes everything you need when (not if) a drive fails. You can easily copy /home, so all user settings are in new install. And export & import list of apps to make it easy to reinstall all of them. If you edited anything in /etc, you may want that also. I edit grub but just copy files into /home so my backup of /home includes the few files I edit in /etc. – oldfred May 20 '21 at 20:12

1 Answers1

2

there might be a way to go, but it is combined with a little work. So what will we be doing? first we copy the system to its new location. Then we have to make some adjustments to the copied fstab to represent the new location of the root partition and we will chroot into the copied system to adjust the boot files.

Prerequisites:

  1. create a ext4 partition in the unallocated space on /dev/sda
  2. mount the newly created partition to /mnt via sudo mount /dev/sda6 /mnt - it might have a different number at the end but gparted will tell you
  3. get the uuid of the new partition ls -la /dev/disk/by-uuid/ and write it down

Copy files

copy the content of your current / to the new partition with: sudo rsync -aAXv / --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt

Make necessary corrections

  1. adjust the fstab on the new location via sudo nano /mnt/etc/fstab and exchange the uuid in the entry for /; afterwards it should look like UUID={UUID-of-the-new-partition} / ext4 errors=remount-ro 0 1
  2. mount necessary directories to /mnt for chroot for dir in /dev /dev/pts /proc /sys /run; do sudo mount --bind $dir /mnt$dir; done
  3. lets not forget the boot/efi sudo umount /dev/sda1 && sudo mount /dev/sda1 /mnt/boot/efi
  4. chroot into the copied system sudo chroot /mnt /bin/bash
  5. update the bootloader sudo update-grub
  6. enter exitto leave the chroot
  7. reboot

Finishing up You now might have two entries for ubuntu in your grub, so you might have to try them to see which one is representing the system in the new location. If it booted fine and you have checked that everything works as intended you can delete the old ubuntu partition in gparted and run sudo update-grub again so there is only one ubuntu left.

hope this helped

d1bro
  • 2,304