登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

SeaRiver Blog

实力才是你一生最好的依靠!

 
 
 

日志

 
 

添加交换空间--FreeBSD  

2007-01-04 13:26:19|  分类: FreeBSD |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Swapfiles
You can create a file of a specified size to use as a swap file. In our example here we will use a 64MB file called /usr/swap0. You can use any name you want, of course.

Example 11-1. Creating a Swapfile on FreeBSD

1. Be certain that your kernel configuration includes the memory disk driver (md(4)). It is default in GENERIC kernel.

   device   md   # Memory "disks"

2. Create a swapfile (/usr/swap0):

   # dd if=/dev/zero of=/usr/swap0 bs=1024k count=64

3. Set proper permissions on (/usr/swap0):

   # chmod 0600 /usr/swap0

4. Enable the swap file in /etc/rc.conf:

   swapfile="/usr/swap0"   # Set to name of swapfile if aux swapfile desired.

5. Reboot the machine or to enable the swap file immediately, type:

   # mdconfig -a -t vnode -f /usr/swap0 -u 0 && swapon /dev/md0

6. 查看
   #pstat -T
 
   676/32808 files
   0M/2023M swap space


=====以下是老版本的加入步骤============
系统是FreeBSD 4.8

# cat GENERIC |grep pseudo-device
pseudo-device   md              # Memory "disks"

三、在156上的操作步骤及运行情况
1、建一个 vn-device 设备
   # cd /dev
   # sh MAKEDEV vn0
2、创建一个交换文件
   # dd if=/dev/zero of=/usr/swap0 bs=1024k count=1024(增加1G)
   # ls -lh /usr/swap0
  -rw-------  1 root  wheel          1G Aug 29 11:50 /usr/swap0
3、赋予它(/usr/swap0)一个适当的权限
   # chmod 0600 /usr/swap0
4、在 /etc/rc.conf 中启用交换文件
   # vi /etc/rc.conf
     swapfile="/usr/swap0"
5、命令使交换文件立刻生效
   # vnconfig -e /dev/vn0b /usr/swap0 swap
6、查看
   # pstat -T
   或top

# pstat -T
 60/8136 files
0M/2032M swap space

# top
Mem: 7996K Active, 11M Inact, 13M Wired, 4K Cache, 5216K Buf, 467M Free
Swap: 2032M Total, 2032M Free

  评论这张
 
阅读(499)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018