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