In order to reduce the swap space and allocate that space to some other LV in one of our server. Below is what I followed and it perfectly worked for me. :)
Make sure you have enough physical memory to hold the swap contents.
Now, turn the swap off:
# sync
# swapoff <YOUR_SWAP_PARTITION>
Now check the status
# swapon -s
Then, Use fdisk command:
# fdisk <YOUR_HARDDISK_Where_SWAP_Resides>
List partitions with "p" commandFind Delete your partition with "d" commandCreate a smaller Linux-Swap partition with "n" commandMake sure it is a Linux-Swap partition (type 82) (Change with "t" command)Write partition table with "w" command
Run "partprobe" to update Filesystem table to kernel. (It is very important before proceeding further)
Then,
mkswap <YOUR_NEW_SWAP_PARTITION>
swapon <YOUR_NEW_SWAP_PARTITION>
check to make sure swap is turned on
swapon -s
Now you can use your free space to increase space for other Logical volumes (LV).
Use fdisk command to create new partition, then
# partprobe
# pvcreate <NEW_PARTITION_YOU_CREATED>
# vgextend <VG_TO_INCREASE> <YOUR_NEW_PV>
# lvextend -L +SIZE_TO_INCREASE <LV_NAME>
Note: It is important to sync and turning the swap off before you change any partitions. If you FORGET TO DO THIS, YOU WILL LOSE ALL DATA STORED THERE!!
Make sure you have enough physical memory to hold the swap contents.
Now, turn the swap off:
# sync
# swapoff <YOUR_SWAP_PARTITION>
Now check the status
# swapon -s
Then, Use fdisk command:
# fdisk <YOUR_HARDDISK_Where_SWAP_Resides>
List partitions with "p" commandFind Delete your partition with "d" commandCreate a smaller Linux-Swap partition with "n" commandMake sure it is a Linux-Swap partition (type 82) (Change with "t" command)Write partition table with "w" command
Run "partprobe" to update Filesystem table to kernel. (It is very important before proceeding further)
Then,
mkswap <YOUR_NEW_SWAP_PARTITION>
swapon <YOUR_NEW_SWAP_PARTITION>
check to make sure swap is turned on
swapon -s
Now you can use your free space to increase space for other Logical volumes (LV).
Use fdisk command to create new partition, then
# partprobe
# pvcreate <NEW_PARTITION_YOU_CREATED>
# vgextend <VG_TO_INCREASE> <YOUR_NEW_PV>
# lvextend -L +SIZE_TO_INCREASE <LV_NAME>
Note: It is important to sync and turning the swap off before you change any partitions. If you FORGET TO DO THIS, YOU WILL LOSE ALL DATA STORED THERE!!
No comments:
Post a Comment