Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
98 views3 pages

RHCSA: Create Swap on LVM

The document describes how to create a 200MB logical volume called lv_swap2, format it as swap space, add it to the active swap space, and make the swap space addition permanent by editing /etc/fstab.

Uploaded by

Maher Mechi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views3 pages

RHCSA: Create Swap on LVM

The document describes how to create a 200MB logical volume called lv_swap2, format it as swap space, add it to the active swap space, and make the swap space addition permanent by editing /etc/fstab.

Uploaded by

Maher Mechi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Create swap partition

Question:
Create a logical volume of 200MB called lv_swap2 and add it permanently to the current swap
space.

(scroll down for an answer)


Answer:
Before any kind of operations on LVM it is good to know what we actually have in the system.
The proper command to list all devices we can use is in order pvs, vgsand lvs. It shows all
physical storages and devices, volume groups and logical volumes.

First we create a logical volume that is mentioned in the question and we create swap on it:

lvcreate –size 200M –name lv_swap2 /dev/vg


mkswap /dev/vg/lv_swap2
swapon /dev/vg/lv_swap2

To make swap changes permanent as usual /etc/fstab must be edited:

vi /etc/fstab
/dev/vg/lv_swap2 swap swap defaults 0 0

It is good to check if everything works - the best way is to reboot the system (if possible) and
after that issuing:

swapon -s
free -k

which will show swap/memory statistics.

Additional comment:
Both commands mkswap and swapon have parameters like -L and -U so it is possible to give these
commands not only the path (to the file or partition) but label or UUID.

You might also like