0

I have a dual boot Windows + Ubuntu machine. There is plenty of space in my /home partition and recently I got an error message showing that I have low disk space in /root. I want to resize my /root an put some of the space from /home into /root. Unfortunately I cannot find the /root in GParted.

Here is an image of the GParted screen.

gparted

Lorenz Keel
  • 8,362
  • 8
  • 36
  • 49
  • 1
    Partition(s) are mounted, and you can't resize whilst mounted. The easiest way is by booting *live* media (such as Ubuntu install media) using the *Try Ubuntu* option and resize from there. – guiverc Oct 02 '20 at 12:43
  • Edit your question and show me `free -h` and `grep -i swap /etc/fstab`, and tell me what version Ubuntu you're running, and I can make the best recommendation. Start comments to me with @heynnema or I'll miss them. – heynnema Oct 02 '20 at 13:28
  • 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. Thanks! – heynnema Oct 02 '20 at 13:54
  • You say that "unfortunately I cannot find the `/root` in GParted". The `/root` partition is the one called `/` in the Mount Point column. – Lorenz Keel Oct 02 '20 at 14:01
  • Status please... – heynnema Oct 04 '20 at 03:03
  • Status please... – heynnema Oct 06 '20 at 13:45

1 Answers1

1

We'll convert your partition-based swap, to a /swapfile. We'll delete the swap partition, and use that unallocated space to increase the / partition. You'll need to have a bootable Ubuntu Live DVD/USB to proceed.

Edit /etc/fstab...

To edit, use sudo -H gedit /etc/fstab or sudo pico /etc/fstab

and comment out this line:

UUID=xxxx-xxxx-xxxx-xxxx none  swap       sw       0       0

Save the edit and quit the editor

Boot to a Ubuntu Live DVD/USB

Start gparted.

Do a swapoff on the /dev/nvme0n1p6 partition

Delete the /dev/nvme0n1p6 partition, as it won't be used any more

Drag the right side of the /dev/nvme0n1p5 partition all the way right

Click the Apply button

Quit gparted

Reboot

Create a /swapfile...

Note: Incorrect use of the dd command can cause data loss. Suggest copy/paste.

In the terminal...

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm xxG RAM and 4G swap

Confirm this /swapfile line at the end of /etc/fstab... and confirm no other uncommented “swap” lines...

To edit, use sudo -H gedit /etc/fstab or sudo pico /etc/fstab

Note: Use SPACES, not TABS

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation
heynnema
  • 68,647
  • 15
  • 124
  • 180