How do I create a swapfile in Linux?

How do I create a swapfile in Linux?
Answer
How to add Swap File
  1. Create a file that will be used for swap: sudo fallocate -l 1G /swapfile. …
  2. Only the root user should be able to write and read the swap file. …
  3. Use the mkswap utility to set up the file as Linux swap area: sudo mkswap /swapfile.
  4. Enable the swap with the following command: sudo swapon /swapfile.
 

Tìm kiếm

Back
Top