手机版
你好,游客 登录 注册
背景:
阅读新闻

使用dd添加swap大小

[日期:2013-01-24] 来源:Linux社区  作者:staricqxyz [字体:大 中 小]

当前swap是5951M,创建一个512M的空文件

[root@www.linuxidc.com ~]# free -m 
            total      used      free    shared    buffers    cached 
Mem:          3947        793      3154          0        15        367 
-/+ buffers/cache:        410      3537 
Swap:        5951        651      5300 
[root@www.linuxidc.com ~]# 
[root@www.linuxidc.com ~]# dd if=/dev/zero of=/swap_mount bs=1024 count=524288 
524288+0 records in 
524288+0 records out 
536870912 bytes (537 MB) copied, 1.49614 seconds, 359 MB/s 
[root@www.linuxidc.com ~]# 
[root@www.linuxidc.com ~]# ls -h /swap_mount 
/swap_mount 
[root@www.linuxidc.com ~]# ls -hl /swap_mount 
-rw-r--r-- 1 root root 512M Jan 24 14:43 /swap_mount 

把swap_mount挂载到swap上

[root@www.linuxidc.com ~]# mkswap /swap_mount 
Setting up swapspace version 1, size = 536866 kB 
[root@www.linuxidc.com ~]# swapon /swap_mount 
[root@www.linuxidc.com ~]# 
[root@www.linuxidc.com ~]# free -m 
            total      used      free    shared    buffers    cached 
Mem:          3947      1317      2630          0        16        885 
-/+ buffers/cache:        415      3532 
Swap:        6463        651      5812 
[root@www.linuxidc.com ~]# 

添加到开机自动挂载

[root@www.linuxidc.com ~]# echo "/swap_mount swap swap defaults 0 0" >> /etc/fstab 
[root@www.linuxidc.com ~]# cat /etc/fstab 
/dev/VolGroup00/LogVol00 /                      ext3    defaults        1 1 
LABEL=/boot            /boot                  ext3    defaults        1 2 
tmpfs                  /dev/shm                tmpfs  defaults        0 0 
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0 
sysfs                  /sys                    sysfs  defaults        0 0 
proc                    /proc                  proc    defaults        0 0 
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0 
/swap_mount swap swap defaults 0 0 

linux
相关资讯       swap  dd  swap大小 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款