How to create Linux Swap file?
The swap partition is a place where system will keep temporary files so that it can do the processing of data bit faster. Suppose your swap is getting filled and there is no raw partition left for creating swap partition on the server what we can do? At any cost your management asked you to increase the swap to improve the system performance. To come out of this situation there is one solution provided by Linux e.i we can create a swap file with in all ready existing and using partition if that partition is having sufficient free space Step 1: Switch off all the swap before any swap related work #swapoff -a Step 2: Determine what is the swap size we required(here i am taking 128 MB) and execute the following command with count equal to 131072 (because 131072 is equal to 128 M) This will create a swap file name swap file in / directory with size of 128 MB. dd if=/dev/zero of=/swapfile bs=1024 count=131072 Let me explain above command. dd is an excellent command which is used to take backups of partitions, create MBR, create empty files etc. Here dd is used to create a empty file called /swapfile by taking input file as /dev/zero with block size as 1024 byts and number of these bytes as 131072. This command will create a file with 128MB. Step 3: Now set this swap file in order...
Read More