System information

existing LVM2 logical volume. It is recommended that you extend an existing logical volume.
15.1.1. Ext ending Swap on an LVM2 Logical Volume
By default, Red Hat Enterprise Linux 6 uses all available space during installation. If this is the case
with your system, then you must first add a new physical volume to the volume group used by the
swap space. For instructions on how to do so, refer to Section 14.2.2, “ Adding Unallocated Volumes
to a Volume Group .
After adding additional storage to the swap space's volume group, it is now possible to extend it. To
do so, perform the following procedure (assuming /d ev/Vo l G ro up0 0 /Lo g Vo l 0 1 is the volume
you want to extend by 2 GB):
Pro ced u re 15.1. Ext en d ing Swap o n an LVM2 Lo g ical Volu me
1. Disable swapping for the associated logical volume:
# swapoff -v /dev/VolGroup00/LogVol01
2. Resize the LVM2 logical volume by 2 GB:
# lvresize /dev/VolGroup00/LogVol01 -L +2G
3. Format the new swap space:
# mkswap /dev/VolGroup00/LogVol01
4. Enable the extended logical volume:
# swapon -v /dev/VolGroup00/LogVol01
To test if the logical volume was successfully extended, use cat /pro c/swaps or free to inspect
the swap space.
15.1.2. Creat ing an LVM2 Logical Volume for Swap
To add a swap volume group (assuming /d ev/Vo l Gro up0 0/Lo gVo l 02 is the swap volume you
want to add):
1. Create the LVM2 logical volume of size 2 GB:
# l vcreate Vo l G ro up0 0 -n Lo g Vo l 02 -L 2G
2. Format the new swap space:
# mkswap /d ev/Vo l Gro up0 0/Lo gVo l 0 2
3. Add the following entry to the /etc/fstab file:
# /d ev/Vo l G ro up0 0 /Lo g Vo l 0 2 swap swap d efaul ts 0 0
4. Enable the extended logical volume:
Chapt er 1 5. Swap Space
115