Quantcast
Channel: Brain Book
Viewing all articles
Browse latest Browse all 195

SWAP FILE OR SWAP SPACE

$
0
0
SWAPFILE OR SWAPSPACE

Add a Swap File
dd if=/dev/zero of=/swapfile bs=1024 count=65536(6MB Swap file)

mkswap /swapfile

swapon /swapfile

/etc/fstab entry for permanent swapfile on boot time
/swapfile          swap            swap    defaults        0 0

[root@svn ~]# cat /proc/swaps
Filename    Type    Size    Used    Priority
/dev/dm-1                           partition    2031612    0    -1
/swapfile                           file    65532    0    -2

Remove the Swap File
swapoff -v /swapfile
remove it entry from /etc/fstab

rm /swapfile

[root@svn ~]# cat /proc/swaps
Filename    Type    Size    Used    Priority
/dev/dm-1                           partition    2031612    0    -1



Add a Swap Space

lvm lvcreate VolGroup00 -n LogVol02 -L 256M
OR
lvcreate VolGroup00 -n LogVol02 -L 256M

mkswap /dev/VolGroup00/LogVol02
/etc/fstab file entry for boot time swap loading
/dev/VolGroup00/LogVol02   swap     swap    defaults     0 0
enable swap space
swapon -va
check swap space
cat /proc/swaps
OR
free

Remove the Logical Volume for Swap

swapoff -v /dev/VolGroup00/LogVol02
lvm lvremove /dev/VolGroup00/LogVol02
remove the entry from /etc/fstab

cat /proc/swaps
OR
free

Extend Swap on Logical Volume

Disable Swapping for that Logical Volume
swapoff -v /dev/VolGroup00/LogVol01
Resize the Logical Volume
lvm lvresize /dev/VolGroup00/LogVol01 -L +256M
Format the new Swap Space
mkswap /dev/VolGroup00/LogVol01
Enable the Extended Logical Volume
swapon -va
Test the Swap
cat /proc/swaps
OR
free

Reduce Swap on a Logical Volume

swapoff -v /dev/VolGroup00/LogVol01

lvm lvreduce /dev/VolGroup00/LogVol01 -L -512M
mkswap /dev/VolGroup00/LogVol01
swapon -va
cat /proc/swaps
OR
free

Viewing all articles
Browse latest Browse all 195

Trending Articles