4

I'm facing an issue in my Ubuntu Mate 18.04 system.

I installed the file system in a LVM partition and would like to enlarge the swap space. I followed the instructions here but I get this message when I try to enlarge the partition

Insufficient free space: 512 extents needed, but only 0 available

This is the content of my disk according to fdisk -l

Disk /dev/sda: 232,9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8F28ED66-4E76-4B77-AB4B-D0AB345E21CA

Device       Start       End   Sectors   Size Type
/dev/sda1     2048   1050623   1048576   512M EFI System
/dev/sda2  1050624 488396799 487346176 232,4G Linux LVM

Disk /dev/mapper/ubuntu--mate--vg-root: 231,4 GiB, 248474763264 bytes, 485302272 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/ubuntu--mate--vg-swap_1: 996 MiB, 1044381696 bytes, 2039808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

It seems like there's no free space left on the Physical volume in order to further enlarge the swap partition. If I type

sudo lvresize -l +100%FREE /dev/ubuntu-mate-vg/swap_1

I get

New size (249 extents) matches existing size (249 extents).

Therefore I'd like to shrink a bit (say, 5 Gb) my main partition vg-root and make that space available for swap. But I don't know how to do it :-/ Do you have any suggestion?

Thank you Marco

1 Answer 1

4

I made it!

What I did was:

  • install Ubuntu on a USB disk
  • run ubuntu without installing it
  • install KVPM on the live session
  • Reduced the main disk partition from KVPM (just a few seconds)
  • Expanded the swap partition from KVPM (just a few seconds again)

Then I rebooted the PC (with my fingers crossed) and I could see the new size of the mail partition but NOT the new - enlarged size of the swap.

What I did then was performing the following:

sudo swapoff /dev/ubuntu-mate-vg/swap_1
sudo mkswap /dev/ubuntu-mate-vg/swap_1
sudo swapon /dev/ubuntu-mate-vg/swap_1

Then the OS could see the whole swapping filesystem.

It wasn't easy so I wanted all of you to know about it.

1
  • 1
    Nice work that you got it right! Apr 23, 2018 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .