QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1121|回复: 4

swap大小如何修改

[复制链接]
发表于 2006-1-3 17:54:19 | 显示全部楼层 |阅读模式
在一台以使用的liunx机器上我想把swap的大小改大,请问步骤是怎样的呢?谢谢
发表于 2006-1-3 19:03:34 | 显示全部楼层
重新分区(很有可能需要重新安装系统)。
回复

使用道具 举报

发表于 2006-1-3 20:05:34 | 显示全部楼层
[quote:82579cf8b8="shadkong"]重新分区(很有可能需要重新安装系统)。[/quote]

不用吧!以下命令应该能行。(没有试过)
#swapoff /dev/hda3        #停用swap,假设原来swap分区为/dev/hda3
#mkswap -c /dev/hda4   #创建新的swap,假设新的分区为/dev/hda4
#swapon /dev/hda4        #启用swap
回复

使用道具 举报

 楼主| 发表于 2006-1-4 11:33:37 | 显示全部楼层
这是我找到的解决方案,谢谢各位!!!

1.查看系统Swap空间使用

[root@jumper usr]# free
             total       used       free     shared    buffers     cached
Mem:        513980     493640      20340          0     143808     271780
-/+ buffers/cache:      78052     435928
Swap:      1052248      21256    1030992

2.在空间合适处创建swap文件

[root@jumper usr]# mkdir swap
[root@jumper usr]# cd swap
[root@jumper swap]# dd if=/dev/zero of=swapfile bs=1024 count=10000
10000+0 records in
10000+0 records out
[root@jumper swap]# ls -al
total 10024
drwxr-xr-x    2 root     root         4096  7月 28 14:58 .
drwxr-xr-x   19 root     root         4096  7月 28 14:57 ..
-rw-r--r--    1 root     root     10240000  7月 28 14:58 swapfile


[root@jumper swap]# mkswap swapfile
Setting up swapspace version 1, size = 9996 KiB


3.激活swap文件
[root@jumper swap]# swapon swapfile
[root@jumper swap]# ls -l
total 10016
-rw-r--r--    1 root     root     10240000  7月 28 14:58 swapfile
[root@jumper swap]# free
             total       used       free     shared    buffers     cached
Mem:        513980     505052       8928          0     143900     282288
-/+ buffers/cache:      78864     435116
Swap:      1062240      21256    1040984
[root@jumper swap]#
回复

使用道具 举报

发表于 2006-1-4 13:56:59 | 显示全部楼层
http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=124133
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-9-23 17:23 , Processed in 0.042325 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表