User Tools

Site Tools


handbook:handbook:filesystem:swap:add_a_swap_partition

Create a new swap partition:

fdisk /dev/sdb

1. press n to create a new disk partition,
2. press p to create a primary disk partition,
3. press 1 to denote it as 1st disk partition
4. press ENTER twice to accept the default of 1st and last cylinder – to convert the whole secondary hard disk to a single disk partition
5. press t (will automatically select the only partition – partition 1) to change the default Linux partition type to swap 82
6. press L to list all the currently supported partition type
7. press 82 (as per the L listing) to change partition 1 to 82 for Linux swap partition type
8. press p to display the secondary hard disk partition setup (1st partition is denoted as /dev/sdb1 in Linux)
9. press w to write the partition table and exit fdisk upon completion.

# mkswap /dev/sdb1
# swapon -av           ---- activate all swap 
# swapon -s            ---- show active swap
# vi /etc/fstab  and add the following line:
/dev/sdb2    swap   swap   defaults   0 0 


After modifying the fstab, always check if everything is mounting fine with :

# mount -a 

handbook/handbook/filesystem/swap/add_a_swap_partition.txt · Last modified: 2011/10/25 09:26 by eduard