[SOLVED] Changing Swap Size on LVM

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
fibrou
Level 2
Level 2
Posts: 83
Joined: Fri Feb 05, 2021 5:57 pm
Location: USA

[SOLVED] Changing Swap Size on LVM

Post by fibrou »

I want to increase my Swap Disk size on a LVM formatted disk. I am following general steps I see here and other places as follows:

Code: Select all

fibrou@jpbsBoominLM:~$ lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                 8:0    0 931.5G  0 disk 
└─vgmint-root     253:0    0   1.9T  0 lvm  /
sdb                 8:16   0   477G  0 disk 
├─sdb1              8:17   0   100M  0 part 
├─sdb2              8:18   0    16M  0 part 
├─sdb3              8:19   0 119.7G  0 part 
├─sdb4              8:20   0   498M  0 part 
└─sdb5              8:21   0 356.7G  0 part 
sdc                 8:32   0   3.7T  0 disk 
└─sdc1              8:33   0   3.7T  0 part /run/timeshift/backup
nvme0n1           259:0    0 953.9G  0 disk 
├─nvme0n1p1       259:1    0   512M  0 part /boot/efi
└─nvme0n1p2       259:2    0 953.4G  0 part 
  ├─vgmint-root   253:0    0   1.9T  0 lvm  /
  └─vgmint-swap_1 253:1    0   976M  0 lvm  [SWAP]
  
fibrou@jpbsBoominLM:~$ sudo swapoff -v /dev/vgmint/swap_1
swapoff /dev/vgmint/swap_1
But when I attempt to resize the LVM

Code: Select all

fibrou@jpbsBoominLM:~$ sudo lvresize -L+64G /dev/vgmint/swap_1
  Insufficient free space: 16384 extents needed, but only 0 available
There appears to be plenty of space for me to have a larger Swap drive.

What am I doing incorrectly to increase my existing LVM Swap drive from 1GB to 64GB?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: Changing Swap Size on LVM

Post by Moonstone Man »

fibrou wrote: Thu Mar 18, 2021 6:33 pm What am I doing incorrectly to increase my existing LVM Swap drive from 1GB to 64GB?
Normally I consider it absolutely none of my business as to why you want to do a certain thing, but this is a rare exception.

Why on earth do you feel that you need such a massive swap file? How much RAM do you have? Why is a 1GB swap not sufficient?
fibrou
Level 2
Level 2
Posts: 83
Joined: Fri Feb 05, 2021 5:57 pm
Location: USA

Re: Changing Swap Size on LVM

Post by fibrou »

Well, I have a corpus of annual reports on which I am trying to run NLP routines. Dataset is > 125GB+, but when I clean it as best I can record, or report-by-report, I still only get it down to about 40GB. I just increased RAM on my machine from 16GB to 32GB, but program "chokes" reading in that amount of data.

I don't know why I chose 64GB. I am sure I could get by with less, but all I am trying to do is read the data in, and run some routines. I have the space, so my objective is solely the analysis.

Any steps to help me increase my Swap size are greatly appreciated.
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: Changing Swap Size on LVM

Post by Moonstone Man »

fibrou wrote: Thu Mar 18, 2021 9:01 pm Any steps to help me increase my Swap size are greatly appreciated.
I can't help with LVM. What I can do though is offer some pointers on the other issue:
I still only get it down to about 40GB. I just increased RAM on my machine from 16GB to 32GB, but program "chokes" reading in that amount of data.
It's not often that we see 32GB of RAM getting topped out. I work with gigantic datasets and to troubleshoot the cause you might want to consider creating a cut down dataset of 32GB and see if a) the swap gets hit, and b) the application chokes. If either the a) or b) condition occurs, cut the dataset down by 2 or so GB and have another go. I'm suggesting that approach because it's the best way to be certain of the cause. It will also help to give you a better grasp of the actual swap size you're going to need in order to work on the complete dataset if the b) condition isn't the root cause. If the application reads the whole dataset instead of paging it then you're going to need in the order of 120GB of swap just to be safe.

Regarding the LVM swap issue, if the extend commands weren't working, I'd dismantle the swap volume and just make a bigger one. If you go that route, the only other change you might need to make would be to the mount options in fstab.
fibrou
Level 2
Level 2
Posts: 83
Joined: Fri Feb 05, 2021 5:57 pm
Location: USA

Re: Changing Swap Size on LVM

Post by fibrou »

Thanks, but the data are cut-down as far as I can.

Anybody else familiar with LVM enough to help?
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: Changing Swap Size on LVM

Post by Moonstone Man »

fibrou wrote: Thu Mar 18, 2021 10:59 pm Thanks, but the data are cut-down as far as I can.
Well, if you can't make a test datatset then you're stuck and you'll need to sort it out yourself.
fibrou
Level 2
Level 2
Posts: 83
Joined: Fri Feb 05, 2021 5:57 pm
Location: USA

Re: Changing Swap Size on LVM

Post by fibrou »

Ok. Thanks again.

Anybody else want to help extend the size of a Swap?
User avatar
zcot
Level 9
Level 9
Posts: 2838
Joined: Wed Oct 19, 2016 6:08 pm

Re: Changing Swap Size on LVM

Post by zcot »

You can't increase swap because the total of the room between home and swap is fixed to the total size at creation time.

You can shrink home by exactly the amount you need, or more, and will able to do it easily.

Take a look here: viewtopic.php?p=1803964#p1803964
Locked

Return to “Storage”