Create a Linux Swap File.
Swap is a space on a disk that is used when the amount of physical RAM memory is full.
When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space.
Swap space can take the form of either a dedicated swap partition or a swap file.
How does Linux swap work?
Linux uses swap space to increase the amount of virtual memory available to a host. It can use one or more dedicated swap partitions or a swap file on a regular filesystem or logical volume. There are two basic types of memory in a typical computer.
Is swap needed Linux?
Swap does not change the amount of RAM required for a healthy server, or desktop for that matter. It’s designed to be complimentary to performance on healthy systems. To summarize: — Even if there is still available RAM, the Linux Kernel will move memory pages which are hardly ever used into swap space.
How do I swap memory in Linux?
- From your root userid, enter the command “swapon -s”. This will show your allocated swap disk or disks, if any.
- Enter the command “free”. This will show both your memory and your swap usage.
- In either of the above, look for the used space, compared to the total size.
How much swap space do I need?
For more modern systems (>1GB), your swap space should be at a minimum be equal to your physical memory (RAM) size “if you use hibernation”, otherwise you need a minimum of round(sqrt(RAM)) and a maximum of twice the amount of RAM.
Photo in the article by “Wikipédia”