使用文件方式扩展swap分区
时间:2010-10-15 来源:superior_2008
dd if=/dev/zero of=/tmp/swap bs=4k count=16382 |
注释:
位置为:/tmp/swap,其类型为data
容量为:4K * 16382
dd命令解释
Unlike the Unix dd, this works when an odd number of bytes are read. If the input file contains an odd number of bytes, the last byte is simply copied (since there is nothing to swap it with). |
2)创建swap数据
mkswap /tmp/swap # 该指令一定要注意,否则系统文件系统将被毁掉!!!! |
3)查看添加Swap文件前系统Swap容量
|
4)开启Swap文件
swapon /tmp/swap |
5)查看开启后Swap容量
|
6)关闭Swap
swapoff /tmp/swap |
---- 结束