solaris10 下创建交换分区

今天线上有一台服务器的DB宕机了。其实那台机器内存不少,64G,但是跑了三个实例。DB crash之后,根据Oracle的建议,增加Swap。

Linux上的方式是dd出一个文件,然后mkswap,swapon。在Solaris上相对简单,不用dd。

1)建立swap文件
mkfile 48G /var/swapfile

2)加入到系统swap里
swap -a /var/swapfile

3)查看swap
swap -l
root@localhost:~ # swap -l
swapfile             dev  swaplo blocks   free
/dev/md/dsk/d20     85,20     16 16586864 16586864
/var/swapfile    -       16 71303152 71303152

swap -s 
root@localhost:~ # swap -s
total: 11537920k bytes allocated + 7256976k reserved = 18794896k used, 74469472k available

4)加到vfstab,重启之后不会丢失
vi /etc/vfstab
/var/swapfile - - swap - no -

Done!

------------------------------------------------------------------

solaris下增加swap空间失败: is not valid for swapping
# ls
bin           home          net           proc          u01
dev           kernel        opt           sbin          u02
etc           lib           oradiag_root  system        usr
export        mnt           platform      tmp           var
# mkfile 10m /swapfile
# ls -al swapfile
-rw-------   1 root     root     10485760 Oct 14 11:33 swapfile
# swap -a /swapfile
"/swapfile" is not valid for swapping.
It must be a block device or a regular file with the
"save user text on execution" bit set.

哪位高手指点一下!
------解决方案--------------------------------------------------------
它说你那个块设备或者文件必须要设置sticky bit才能作为swap文件系统。


For regular files on some older systems, the
       bit  saves  the  program’s  text image on the swap device so it will load more quickly
       when run; this is called the sticky bit.

所以你可以这么做。
# chmod 1777 /swapfile



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值