2

About a week ago, I did a clean install of Ubuntu 18.04.3 Desktop on my 8GB laptop, exactly as in this other upvoted question. I chose LVM and encryption.

Somehow, Ubuntu decided to create a very small swap partition - only 1GB. This results in frequent freezes as the OS is thrashing the tiny swap partition when more than a few applications are open. (I still don't understand how in almost 2020, Ubuntu still doesn't have any way to warn the user of running out of memory ).

Anyway, I followed the steps to create a swap file. The file is used after swapon, but not after reboot:

$ sudo swapon -s
Filename                Type        Size    Used    Priority
/dev/dm-2                               partition   1003516 0   -2

$ ls -al /swapfile
-rw------- 1 root root 17179869184 Dec  3 13:39 /swapfile

$ grep SwapTotal /proc/meminfo
SwapTotal:       1003516 kB

Also, I don't see the swap partition in Gparted after booting from a rescue USB stick:

No swap partition in Ubuntu 18.04

  1. What is going on here with the partitions? What are those <1GB partitions, especially the second one, and why are they taking up disk space?
  2. How can I get rid of the swap partition, wherever it may be?
  3. How can I force Ubuntu to use the swap file?

Note that I installed Ubuntu 18 last year, and didn't run into this silly situation. This looks like a regression - is there a Launchpad ticket tracking it?

  • 1
    You may want to post your /etc/fstab. With an encrypted partition, you certainly will have a separate boot because bootloaders do not understand encryption. swap is inside your /dev/nvme..p3, which is the partition containing your LVM partitions. An advantage of LVM is that it is easy to resize partitions. So it would be more obvious to just enlarge your swap partition instead of creating a swap file (which has, as only advantage, that it can easily be resized, but hey, you already have that advantage with LVM). – vanadium Dec 03 '19 at 18:05
  • @vanadium: thanks, I've added an answer about using kpvm to manage logical volumes. – Dan Dascalescu Dec 04 '19 at 02:36

1 Answers1

2

GParted doesn't handle LVM (Logical Volume Management) volumes. You need to install an LVM manager for that, such as kvpm. Shown below is a screenshot of kvpm from my system where you can see the swap volume within the nvme0n1p3 partition.

kpvm screenshot with swap volume

After deleting the swap volume, kvpm crashed, but then I was able to resize the root volume to include the extra ~1GB that the swap volume had occupied (right click, Extend logical volume):

kpvm resize screenshot

I still don't know what the ext4 partition from my question (nvme0n1p2) is used for.

Also, once I deleted the swap volume, I was unable to create another one due to lack of space. The option to Reduce the size of the root volume was grayed out.

I confess I don't fully understand LVM and kvpm, so I'd stick with a swapfile, which is clear and simple to manage (delete and recreate with different size).