Creating a Swap File

简介:

To add a swap file:

  1. Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks. For example, the block size of a 64 MB swap file is 65536.

  2. At a shell prompt as root, type the following command with count being equal to the desired block size:

    dd if=/dev/zero of=/swapfile bs=1024 count=65536
  3. Setup the swap file with the command:

    mkswap /swapfile
  4. To enable the swap file immediately but not automatically at boot time:

    swapon /swapfile
  5. To enable it at boot time, edit /etc/fstab to include the following entry:

    /swapfile          swap            swap    defaults        0 0

    The next time the system boots, it enables the new swap file.

  6. After adding the new swap file and enabling it, verify it is enabled by viewing the output of the command cat /proc/swaps or free.










本文转自 Art_Hero 51CTO博客,原文链接:http://blog.51cto.com/curran/1357742,如需转载请自行联系原作者
目录
相关文章
|
2月前
|
Java
cannot open shared object file: No such file or directory
cannot open shared object file: No such file or directory
21 0
|
9月前
ftok info: No such file or directory
ftok info: No such file or directory
102 0
autoreconf: failed to run autopoint: No such file or directory
autoreconf: failed to run autopoint: No such file or directory
134 0
【问题】Log writing failed, No space left on device @ io_write - /mnt/project/log/development.log
【问题】Log writing failed, No space left on device @ io_write - /mnt/project/log/development.log
141 0
【问题】Log writing failed, No space left on device @ io_write - /mnt/project/log/development.log
E297: Write error in swap file
当我使用vim编辑一个常用的配置文件的时候出现一个错误: E297: Write error in swap file 然后上网查找原因,说是磁盘空间不足,于是我就查看一下机器磁盘空间使用情况: sht-sgmhadoopdn-02:postgres:/usr/loca...
2420 0
|
Oracle 关系型数据库 Linux
[20180109]disk file operations.txt
[20180110]disk file operations.txt --//调查生产系统相关disk file operations问题,记录一下: 1.环境: XXXX> @ &r/ver1 PORT_STRING                  ...
1076 0