Alexander / Aebian

Alexander / Aebian

Who am I?

Musician, Programmer, Linux Geek and what not.  more...


The Categories



Stuff

Cookie Policy
Media Creations
My Projects
Some Spotify

April 22nd at 5:43pm
S ➠

❬ Back to Blog


Extend swap size on Linux


This post will cover the plain details on how to extend a swap partition. No stories, just facts!

This post just covers the basic details of how to extend the swap space partiton.

First you wanna make sure your disk drive has enough space available for resizing, otherwise you may lose data.
So open up your terminal and type df -h the output will be something like this:


Make sure your mount point on / has enough space free.
Otherwise free some space up or attach another disk and extend the mount point.
The next thing you want to do is to display the volume group for the device.

In most cases /dev/sda/ with sda1 and sda2 is the default "system drive". So just enter this command: vgdisplay.
After that your output should look like this:


The VG Name section is our thing we need.
First we need to resize our normal disk and remove some Gigabytes we later on need for adding them to the swap partition.
Enter in the terminal: lvresize /dev/vg_redhat66tp/lv_root -L -2G You get something like:


Accept that and you now have 2 extra Gigabytes free for usage with the swap partition. So lets extend it!
lvresize /dev/vg_redhat66tp/lv_swap -L +2G The output will likely be:

Thats it, you're done!



Regards,

A/