Type the following command to create 100MB swap file (1024 * 100MB = 102400 block size):
dd if=/dev/zero of=/swap1 bs=1024 count=102400Secure swap file
Setup correct file permission for security reasons, enter:
# sudo chown root:root /swap1# sudo chmod 0600 /swap1Set up a Linux swap area
Type the following command to set up a Linux swap area in a file:
# sudo mkswap /swap1Activate /swap1 swap space :
# sudo swapon /swap1Update /etc/fstab file to make it persistent across reboot.
vi /etc/fstabAdd the following line in file:
/swap1 swap swap defaults 0 0To check if the swap file is added or not
Type the following swapon command:
#sudo swapon -sFilename Type Size Used Priority/dev/dm-0 partition 839676 0 -1/swap1 file 102396 0 -2It should show you the new file.
If you want add a logical volume for swap please refer how to add LV for swap .
No comments:
Post a Comment