Tuesday, May 17, 2011

Swap Partitions & Files

1. Extra, virtual RAM for the OS

1. Identify current swap space
a. swapon -s - enumerates partitions and/or files, which constitute swap storage

b. free -m

2. Select target drive and provision swap partition
a. fdisk /dev/sdb
b. n
c. 2
d. 500
e. +512 (cylinder 562) - 63 cylinders are required for 512MB
f. t - change type
g. 82 - Linux Swap/Solaris
h. w - committ changes to disk

3. Create the swap file system on the raw partition: /dev/sdb2
a. mkswap /dev/sdb2

4. Enable swapping - publish the swap space to the kernel
a. swapon /dev/sdb2 - this enables swapping on /dev/sdb2

5. update /etc/fstab
a. /dev/sdb2 swap swap defaults 0 0

swapoff /dev/sdb2 - disables swapping on /dev/sdb2

1. Improve system performance by distributing swapping to /dev/sdb2
a. swapon /dev/sdb2
b. swapoff /dev/sda6
c. disable /dev/sda6 via /etc/fs