Ubuntu add swap

Posted 瞬_冷

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu add swap相关的知识,希望对你有一定的参考价值。

1. create a 1G file for the swap.

  sudo fallocate -l 1G /swapfile

  we can verify that the correct amount of space was reserved by typing:

  ls -lh /swapfile

2. Enabling the Swap File.

  1.Make the file only accessible by typing:

    sudo chmod 600 /swapfile.

       2.Make the file as swap space by typing:

    sudo mkswap /swapfile

  3.Enabling the swap file and allow our system to start utilizing it .

    sudo swapon /swapfile.

  4.Now you can find that the swap space was added by typing:

    free -h / (sudo swapon --show)

  




以上是关于Ubuntu add swap的主要内容,如果未能解决你的问题,请参考以下文章