Linux - How to create swap file on server, Creating a swap file or swap space

How to create swap file on server

The following arre the steps forcreating a swap file on server.

If you don't have enough swap to start out with, you can create your own swap file with the following commands:


dd if=/dev/zero of=/extra-swap bs=1024 count=1048576
# create a 1Gb file
mkswap /extra-swap 1048576 # format the file as swap
swapon /extra-swap # start swap file


Add swap space to fstab so it is automatically started
 /extra-swap   none   swap   sw   0   0
now you will have 1Gb of swap and can check this with the command free
  # free

By using the free command you can see memory space used by the server. You can also calculated the free and used memory space by the server.

The topic on Linux - How to create swap file on server is posted by - Math

Hope you have enjoyed, Linux - How to create swap file on serverThanks for your time

Tech Bluff