美文网首页
[CENTOS] Create SWAP for CentOS7

[CENTOS] Create SWAP for CentOS7

作者: AlfredL | 来源:发表于2016-05-28 23:14 被阅读0次

    Check the System for Swap Information

    We can see if the system has any configured swap by using swapon, a general-purpose swap utility. With the -s
    flag, swapon will display a summary of swap usage and availability on our storage device:

    swapon -s

    If nothing is returned by the command, then the summary was empty and no swap file exists.

    Check Available Storage Space

    df -h

    Create a Swap File

    sudo fallocate -l 4G /swapfile

    ls -lh /swapfile

    Enable a Swap File

    sudo mkswap /swapfile
    sudo swapon /swapfile

    Make the Swap File Permanent

    sudo nano /etc/fstab
    At the bottom of the file, you need to add a line that will tell the operating system to automatically use the swap file that you created:
    /swapfile swap swap sw 0 0

    相关文章

      网友评论

          本文标题:[CENTOS] Create SWAP for CentOS7

          本文链接:https://www.haomeiwen.com/subject/qtyfdttx.html