1

I'm about to run out of space on my root partition and I have plenty of unallocated space. When creating the partitions, I thought I had enough space, but it turned out that I didn't. On the information I found it says that it is quite risky, so I want to make sure to do it properly. How should I resize the root partition? (I have a dual boot with windows)

Here is the situation:

enter image description here enter image description here enter image description here

Update: I followed your instructions and an error occured:

enter image description here enter image description here

Pablo Bianchi
  • 15,657
Name
  • 13
  • 2
    Little key icons say partitions are mounted. You have to use flash drive live installer so all partitions are unmounted. Any partition change has risks, so you must have good backups of everything on drive. You will have to move /home right, then with unallocated next to / you can expand it right. The move may be slow depending on amount of data it has to move, do not interrupt move as that would totally corrupt data. May sure not on battery power or anything else that might interrupt system. – oldfred Nov 12 '21 at 18:38
  • Use gpartition on a live preview. – gorgo Nov 12 '21 at 18:51
  • Please see my answer. If it's helpful, please remember to accept it by clicking on the checkmark icon that appears just to the left of my answer. Start comments to me with @heynnema or I'll miss them. – heynnema Nov 12 '21 at 20:00
  • 1
  • @PabloBianchi I already solved it but thanks! – Name Nov 13 '21 at 16:23

1 Answers1

3

gparted

Make sure that you have a good backup of your important Ubuntu files, as this procedure can corrupt or lose data.

Keep these things in mind:

  • always start the entire procedure with issuing a swapoff on any mounted swap partitions:
sudo swapoff -a
  • a move is done by pointing the mouse pointer at the center of a partition and dragging it left/right with the hand cursor

  • a resize is done by dragging the left/right side of a partition to the left/right with the directional arrow cursor

  • if any partition can't be moved/resized graphically, you may have to manually enter the specific required numeric data (don't do this unless I instruct you to)

  • you begin any move/resize by right-clicking on the partition in the lower pane of the main window, and selecting the desired action from the popup menu, then finishing that action in the new move/resize window

  • At end the entire procedure, issue a swapon on the same swap partition(s):

sudo swapon -a

Do the following...

Note: if the procedure doesn't work exactly as I outline, STOP immediately and DO NOT continue.

  • boot to a Ubuntu Live DVD/USB, in “Try Ubuntu” mode
  • start gparted
  • resize the left side of /dev/nvme0n1p6 to the right by approximately 70G
  • resize the right side of /dev/nvme0n1p5 all the way to the right
  • click the Apply icon

When done, quit gparted and reboot.

Update #1:

GRUB

Edit /etc/default/grub and edit these two lines at the top of the file...

GRUB_DEFAULT=saved    # edit this line
GRUB_SAVEDEFAULT=true # add this line

sudo update-grub # write the changes to disk

reboot # verify results

At the GRUB menu, manually select Ubuntu to boot. It will remember this selection until you manually change it to something else.

Update #2:

Windows

Source: How do I install Ubuntu alongside a pre-installed Windows with UEFI?

Another issue that could make the system boot directly to Windows (without even showing the GRUB menu) is if either Windows took hold of the boot manager or after installing Ubuntu, the EFI partition was not properly configured for Windows. To solve this, simply go to Windows and open a terminal, then type the following (Need Administrative Privileges):

bcdedit /set {bootmgr} path \EFI\ubuntu\shimx64.efi

This will configure the Windows Boot Manager to take into consideration the GRUB Boot Manager. This could still happen even after running the Boot Repair from within Ubuntu. So making sure that Windows reads the Ubuntu EFI partition, in case you are using an EFI boot system instead of the old BIOS will solve it. In the above command line, the difference between shimx64.efi and grubx64.efi is that shimx64 is the actual Microsoft signed binary that works with Secure Boot enabled while grubx64 is the normal grub binary (Not signed).

Niko Fohr
  • 1,531
heynnema
  • 70,711
  • Thanks for the instructions, it was really clear. I updated the post with more pictures of the error I had. What should I do now? I have a backup of my root and home directories. – Name Nov 13 '21 at 11:23
  • I forgot to mention you ;) – Name Nov 13 '21 at 13:01
  • @Name You were booted to a Ubuntu Live DVD/USB, correct? Did you follow the instructions in the error dialog... "Partition-->Check"? – heynnema Nov 13 '21 at 14:35
  • Yes I was using a USB and no I didn't follow the instructions because you said to stop immediately and don't continue if the procedure doesn't work exactly as you outline. So I stopped to don't mess it up. I'm going to follow the instructions in the error and tell you how it goes. – Name Nov 13 '21 at 15:07
  • @Name Good job! Let me know how it goes. – heynnema Nov 13 '21 at 15:17
  • it worked! Thank you very much. Also I don't have installed correctly the boot files, to boot to ubuntu I have to press f11 to get the grub maneger and then select ubuntu. I read that I should change the boot order on the UEFI but that doesn't work. Do you know why is that? Or how can I solve it? Thanks again. – Name Nov 13 '21 at 15:27
  • Now I see that I used the wrong tutorial for the installation xd – Name Nov 13 '21 at 15:30
  • @Name See Update #1 in my answer. – heynnema Nov 13 '21 at 15:32
  • It didn't work. Then I checked if the file is still updated after reboot and it is. The pc boots directly into windows if I don't press f11. – Name Nov 13 '21 at 15:49
  • @Name You did Update #1, yes? Try booting again, and this time continue to tap the ESC key as soon as you see the BIOS splash screen, and see if you get to the GRUB menu. – heynnema Nov 13 '21 at 15:52
  • No, it didn't. I booted into windows. – Name Nov 13 '21 at 15:58
  • @Name If you can't get to the GRUB menu, then the problem is either in your UEFI settings in the BIOS (but I think you've already checked that), or it's a setting in Windows that causes the problem. See the lengthy answer at https://askubuntu.com/questions/221835/how-do-i-install-ubuntu-alongside-a-pre-installed-windows-with-uefi and look down to the Troubleshooting section for what to do in Windows. – heynnema Nov 13 '21 at 15:59
  • all right, I'll check that, thank you. – Name Nov 13 '21 at 16:01
  • @Name See Update #2 in my answer. – heynnema Nov 13 '21 at 16:02
  • IT WORKED!! It was update #2. Thank you a lot! – Name Nov 13 '21 at 16:09
  • @Name Great news! You're on your way! – heynnema Nov 13 '21 at 16:10