I'm trying to add/modify a swap partition on my LVM-formatted hard disk by using GParted from a LiveCD. I only see one big partition taking up the whole disk.

Is there a hidden swap?

Does an LVM-formatted system even need a swap?

I'm using Ubuntu 12.10.


2 Answers 2


I do not like using GParted, partially because most of my servers are without GUI.

Here's how to extend a swap setup as a logical volume:

1) Determine the name of the swap logical volume using the "lvs" command:

$ lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
root_lv volgroup0 -wi-ao 7.00G
swap_lv1 volgroup0 -wi-ao 30.00G
tmp_lv volgroup0 -wi-ao 3.00G
usr_lv volgroup0 -wi-ao 7.00G
var_lv volgroup0 -wi-ao 4.00G

2) Turn off the swap partition:

$ swapoff /dev/volgroup0/swap_lv1

3) Resize the swap partition, adding 15GB more space to it:

$ lvresize -L+15G /dev/volgroup0/swap_lv1
Extending logical volume swap_lv1 to 30.00 GB
Logical volume swap_lv1 successfully resized

4) Format the new swap space to make it usable:

$ mkswap /dev/volgroup0/swap_lv1
Setting up swapspace version 1, size = 41875927 kB

5) Turn the swap volume back on:

$ swapon /dev/volgroup0/swap_lv1

6) Use free command to show your new swap space:

$ free -t | grep -i swap
Swap: 30719 0 30719
  • 3
    I have a concern, when doing an lvresize on the swap, if there's no available space (all used by other LVMs in the same VG) shouldn't you need to remove some space from another logical volume before adding to the swap lv?
    – Tmanok
    Sep 24, 2020 at 18:05
  • Worth noting: On my system, swap_1v1 is aliased to two other names: /dev/dm-1 (autocompletes for swapoff/on), and /dev/mapper/volgroup0-swap_1v1
    – jpaugh
    Dec 11, 2020 at 2:59
  • 5
    When running the lvresize command I got an "Insufficient free space" error. Looks like I'd first have to shrink an existing volume, and since the only other volume I have is the root one, that seems not worth the trouble/risk.
    – dskrvk
    Feb 25, 2021 at 3:17
  • 1
    DO NOT SHRINK ROOT WITHOUT --resizefs OPTION, this will corrupt the root filesystem! I made a similar post with DECREASING root FIRST for encrypted LVM, but it might help someone here to. Jun 4, 2022 at 20:52

Whether you use LVM or not has nothing to do with whether you need swap or not.

To view LVM logical volumes, run lvs on the command line, or use the GNOME Disks utility.

The version of GParted that ships with Ubuntu 12.10 does not support LVM. It only sees physical volumes, and cannot resize or move them.

However, the latest version of GParted does support LVM. I would download the GParted Live CD and use that.

You must log in to answer this question.

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