Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, 4 January 2012

Swapping on a File in Linux

This article shows how to create a standard file and configure your linux based system to activate swapping or paging on it.

CREATE THE SWAP FILE


First we create the swap file using dd command. cp is not useful here because swap file has not to contain holes.
# dd if=/dev/zero of=/mnt/swapfile bs=1M count=200 # We create a swap file of 200MByte in size.

For safety we disallow other users to read and modify the file:
# chown root.root /mnt/swapfile
# chmod 600 /mnt/swapfile

Swap size is unlimited for linux kernels after 2.3.3
Kernels after 2.4.10 support up to 32 swap areas.


SET UP THE SWAP FILE