PDA

View Full Version : Fedora 26 - LVM disk - increase SWAP size



stevewalsh
18th September 2017, 12:42 PM
Hello,

Please can someone advise me on how to increase the swap file size ?

I've (attempted to) read many articles on how to do this, but none seemed appropriate - it appeared to my untrained eye that they assumed swap was on another disk ??????

Anyhow, here's the information I've got


sudo fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xdc2b45c2

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1026047 1024000 500M 83 Linux
/dev/sda2 1026048 976773119 975747072 465.3G 8e Linux LVM

Disk /dev/mapper/fedora_fedora-root: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora_fedora-swap: 15.6 GiB, 16710107136 bytes, 32636928 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/fedora_fedora-home: 399.7 GiB, 429177962496 bytes, 838238208 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


sudo blkid
/dev/sda1: UUID="6a49f929-a4fc-4004-a25b-a25823ca470d" TYPE="ext4" PARTUUID="dc2b45c2-01"
/dev/sda2: UUID="qALxVr-lJf8-zGXp-liYB-3OIP-UpX6-Rh5KSY" TYPE="LVM2_member" PARTUUID="dc2b45c2-02"

/dev/mapper/fedora_fedora-root: UUID="e249e7f9-f5ec-4e04-8075-2ebd82c16706" TYPE="ext4"
/dev/mapper/fedora_fedora-swap: UUID="88521811-80b7-4cb5-9488-2620aa261463" TYPE="swap"
/dev/mapper/fedora_fedora-home: UUID="3dd483a1-9be9-48f9-95b1-2208942e2f42" TYPE="ext4"

I was "hoping" that it would be a relatively simple couple of LV commands to make the home "partition"(???) say 10GB smaller, then increasing the swap size by that additional 10GB ????

Any advice is much appreciated,
Thanks Steve

gjaltemba
21st September 2017, 03:48 AM
Swap is slow but if that is what you want then consider creating a 10G swap file in the home partition. It is simpler less risky than resizing home and swap.

http://www.techotopia.com/index.php/Adding_and_Managing_Fedora_Swap_Space

lsatenstein
21st September 2017, 04:42 AM
You can have multiple swap files for a system. You can create a second swap file to make up the difference in size wanted and add it to the /etc/fstab. It does not have to be on the same disk (in case you have more than one disk).

If there is room on a second drive or partition for the total new swap of desired size, create your swap file there, and add it to the fstab, and comment out / remove the existing swapfile. It does not have to be a lvm swap file. A swap file is a swap file

stevewalsh
22nd September 2017, 01:44 PM
Thank you both for the replies...

I'd never thought of having another swap disk, assuming I had to just expand the one I had...

I'll give this a whirl, and see if I get rid of the message from vmware telling me 15.7 GB swap disk isn't enough !

amiga
22nd September 2017, 06:59 PM
I'll give this a whirl, and see if I get rid of the message from vmware telling me 15.7 GB swap disk isn't enough !

Actually you have a 16 GB swap partition, 15.6 is in GiB.

Disk /dev/mapper/fedora_fedora-swap: 15.6 GiB, 16710107136 bytes, 32636928 sectors

How large is the memory allocation in your VM ? Is VMware trying to enforce the old convention of double the RAM to get the swap size ?

stevewalsh
25th September 2017, 10:34 AM
the vmware machine I'm using is configured to use 32GB RAM, and I only have 32GB in the laptop hence I need swap...
(yes, it's a very hungry vm, simulating a rack of servers !)