免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3163 | 回复: 7
打印 上一主题 下一主题

我的swap筆記 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-12-16 17:02 |只看该作者 |倒序浏览
Adding Swap Space
To add a swap partition (assuming /dev/hdb2 is the swap
partition you want to add): fdisk /dev/hdb to make /dev/hdb2
2. Now that you have the swap partition, use the command mkswap to
setup the swap partition. At a shell prompt as root, type the following:
mkswap /dev/hdb2
3. To enable the swap partition immediately, type the following command:
swapon /dev/hdb2
4. To enable it at boot time, edit /etc/fstab to include:
/dev/hdb2 swap swap
defaults 0 0
5. The next time the system boots, it will enable the new swap partition.
6. After adding the new swap partition and enabling it, make sure it is
enabled by viewing the output of the command cat /proc/swaps or
free.
To add a swap file:
1. Determine the size of the new swap file and multiple by 1024 to
determine the block size. 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:
/swapfile swap swap
defaults 0 0
6. The next time the system boots, it will enable the new swap file.
7. After adding the new swap file and enabling it, make sure it is enabled
by viewing the output of the command cat /proc/swaps or free.
Removing Swap Space
To remove a swap partition:
swapoff /dev/hdb2
1. Remove its entry from /etc/fstab.
2. Remove the partition using parted or fdisk. Only parted will be
discussed. To remove the partition with parted:
o At a shell prompt as root, type the command parted /dev/hdb,
where /dev/hdb is the device name for the hard drive with free
space.
o At the (parted) prompt, type print to view the existing partitions
and determine the minor number of the swap partition you wish
to delete.
o At the (parted) prompt, type rm MINOR, where MINOR is the
minor number of the partition you want to remove.
o Type quit to exit parted.
To remove a swap file:
1. At a shell prompt as root, execute the following command to disable the
swap file (where /swapfile is the swap file):
swapoff /swapfile
2. Remove its entry from /etc/fstab.
3. Remove the actual file:
rm /swapfile

论坛徽章:
0
2 [报告]
发表于 2004-12-17 13:14 |只看该作者

我的swap筆記

学习中。。。
谢谢!
另:如何看swap分区的使用情况?不会是用free看吧。

论坛徽章:
0
3 [报告]
发表于 2004-12-17 13:37 |只看该作者

我的swap筆記

是free

论坛徽章:
0
4 [报告]
发表于 2004-12-20 16:12 |只看该作者

我的swap筆記

         强顶一下,如果是中文的就更好一点了,偶类E文太菜了,楼主的资料我都看了一会再搞明白。

论坛徽章:
3
2015年迎新春徽章
日期:2015-03-03 17:23:07综合交流区版块每日发帖之星
日期:2015-08-19 06:20:00综合交流区版块每日发帖之星
日期:2015-09-15 06:20:00
5 [报告]
发表于 2004-12-20 19:53 |只看该作者

我的swap筆記

感谢!!

我认为英文也是好事呀,顺便可以学学英文

论坛徽章:
0
6 [报告]
发表于 2004-12-20 23:44 |只看该作者

我的swap筆記

收藏,有用

论坛徽章:
0
7 [报告]
发表于 2004-12-21 09:26 |只看该作者

我的swap筆記

cat /proc/swaps也可以看到swap分区的情况

论坛徽章:
0
8 [报告]
发表于 2004-12-23 08:48 |只看该作者

我的swap筆記

是linux系统的吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP