当前位置: 老葡京网站娱乐 > 操作系统 > Unix > 正文

Solaris 11中如何添加swap

时间:2016-02-12

老葡京网站娱乐 www.sdguanhua.com 查看当前swap大小,是2G

root@vzwc1:~# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool                      8.68G  40.0G  4.90M  /rpool
rpool/ROOT                 4.03G  40.0G    31K  legacy
rpool/ROOT/solaris         4.03G  40.0G  3.72G  /
rpool/ROOT/solaris/var      265M  40.0G   202M  /var
rpool/VARSHARE               43K  40.0G    43K  /var/share
rpool/dump                 2.58G  40.1G  2.50G  -
rpool/export                900K  40.0G    32K  /export
rpool/export/home           868K  40.0G    34K  /export/home
rpool/export/home/grid     36.5K  40.0G  36.5K  /export/home/grid
rpool/export/home/oracle     45K  40.0G    45K  /export/home/oracle
rpool/export/home/zhongwc   752K  40.0G   752K  /export/home/zhongwc
rpool/swap                 2.06G  40.1G  2.00G  -
root@vzwc1:~# swap -l -h
swapfile             dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 285,2        4K     2.0G     2.0G

ZFS不支持mkfile的方式添加swap

root@vzwc1:~# mkfile 5g /var/swapfile
root@vzwc1:~# swap -a /var/swapfile 
/var/swapfile: Invalid operation for this filesystem type

可以使用zfs set的方式添加swap

root@vzwc1:~# zfs set volsize=5G rpool/swap

再次查看swap

root@vzwc1:~# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
rpool                      11.8G  36.9G  4.90M  /rpool
rpool/ROOT                 4.03G  36.9G    31K  legacy
rpool/ROOT/solaris         4.03G  36.9G  3.72G  /
rpool/ROOT/solaris/var      265M  36.9G   202M  /var
rpool/VARSHARE               43K  36.9G    43K  /var/share
rpool/dump                 2.58G  37.0G  2.50G  -
rpool/export                900K  36.9G    32K  /export
rpool/export/home           868K  36.9G    34K  /export/home
rpool/export/home/grid     36.5K  36.9G  36.5K  /export/home/grid
rpool/export/home/oracle     45K  36.9G    45K  /export/home/oracle
rpool/export/home/zhongwc   752K  36.9G   752K  /export/home/zhongwc
rpool/swap                 5.16G  37.1G  5.00G  -
root@vzwc1:~# swap -l -h
swapfile             dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 285,2        4K     2.0G     2.0G
/dev/zvol/dsk/rpool/swap 285,2      2.0G     3.0G     3.0G

关闭和启动图形界面也有所变化

关闭图形界面

svcadm disable svc:/application/graphical-login/gdm:default

启动图形界面

svcadm enable  svc:/application/graphical-login/gdm:default