Add the swap partition 2008-10-2310: 581 in linux and check the current partition (use free-m or cat/proc/s
Add swap partitions in linux
10: 581. check the current partition (use free-m or cat/proc/swaps ):
[Root @ db2 root] # free-m
Total used free shared buffers cached
Mem: 1006 84 922 0 11 38
-/+ Buffers/cache: 35 971
Swap: 0 0 0
[Root @ db2 root] #
2. increase the swap partition file and size:
Check that no swap exists. add the following:
Determine the size of the new swap file. multiply the size by 1024 to determine the size of the block. For example, if the block size of a 64 MB swap file is 65536, enter the following command as the root user at the shell prompt, where count is equal to the expected block size.
[Root @ db2 root] # dd if =/dev/zero of =/home/swap bs = 1024 count = 1024000
1024000 + 0 records in
1024000 + 0 records out
[Root @ db2 root] #
Run the following command to set the file exchange:
[Root @ db2 root] # mkswap/home/swap
Setting up swapspace version 1, size = 1023996 KiB
[Root @ db2 root] #
3. enable swap partition file:
To enable the swap file immediately instead of automatically enabling it during boot, run the following command:
[Root @ db2 root] # swapon/home/swap
Check the added exchange information:
[Root @ db2 root] # free-m
Total used free shared buffers cached
Mem: 1006 994 12 0 4 929
-/+ Buffers/cache: 60 946
Swap: 999 0 999
[Root @ db2 root] #
To enable it during boot, edit the/etc/fstab file to include the following lines (/home/swap defaults 0 0 ):
[Root @ db2 root] # vi/etc/fstab
LABEL = // ext3 defaults 1 1
LABEL =/boot ext2 defaults 1 2
None/dev/pts devpts gid = 5, mode = 620 0 0
None/proc defaults 0 0
None/dev/shm tmpfs defaults 0 0
LABEL =/usr ext3 defaults 1 2
/Dev/sda5 swap defaults 0 0
/Dev/cdrom/mnt/cdrom iso9660 noauto, owner, kudzu, ro 0 0
/Dev/fd0/mnt/floppy auto noauto, owner, kudzu 0 0
/Home/swap defaults 0 0
The system will enable the new swap file upon next boot.
Check the added information again:
[Root @ db2 oracledb] # free-m
Total used free shared buffers cached
Mem: 1006 979 27 0 6 917
-/+ Buffers/cache: 54 952
Swap: 999 0 999