RAM
Thủ tục thêm swap bằng file:
--1
# swap -s total: 44750504k bytes allocated + 3550360k reserved = 48300864k used, 143647648k available
--2# swap -l swapfile dev swaplo blocks free /dev/zvol/dsk/swappool/swap 256,1 16 268435440 211978800--3# df -k / Filesystem kbytes used avail capacity Mounted on rpool/ROOT/10u9S_144534 70189056 11505600 22912949 34% /--4# mkdir -p /usr/local/swap # mkfile 20m /usr/local/swap/newswap # swap -a /usr/local/swap/newswap--Verify# swap -l # swap -s--Remove# swap -d /usr/local/swap/newswap# swap -l # swap -sThêm swap bằng physical disk:Kiểm tra swap devices hiện tại:
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568Add c1t2d0 vào swap
bash-3.00# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci15ad,1976@10/sd@0,0
1. c1t1d0
/pci@0,0/pci15ad,1976@10/sd@1,0
2. c1t2d0
/pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number):
bash-3.00# swap -a /dev/dsk/c1t2d0s2Kiểm tra swap devices hiện tại:
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568
/dev/dsk/c1t2d0s2 30,194 8 2091000 2091000Add entry vào Vfstab:# vi /etc/vfstab
/dev/zvol/dsk/rpool/swap - - swap - no -
/dev/dsk/c1t2d0s2 - - swap - no -Để bỏ đĩa vừa add vào
bash-3.00# swap -d /dev/dsk/c1t2d0s2Add swap mới bằng zfs datasetTạo zfs dataset cho swap:bash-3.00# zfs create -V 900M rpool/swap1Liệt kê zfs filesystems:
bash-3.00# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 4.59G 3.22G 34.5K /rpool
rpool/ROOT 3.58G 3.22G 21K legacy
rpool/ROOT/new_stage3 126K 3.22G 3.58G /.alt.new_stage3
rpool/ROOT/sol_stage2 3.58G 3.22G 3.57G /
rpool/ROOT/sol_stage2@new_stage3 1.53M - 3.58G -
rpool/dump 512M 3.22G 512M -
rpool/swap 528M 3.74G 16K -
swappool 929M 47.3M 21K /swappool
rpool/swap1 929M 929M 16K -Activate New swap:
bash-3.00# swap -a /dev/zvol/dsk/rpool/swap1
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/rpool/swap 181,1 8 1048568 1048568
/dev/zvol/dsk/swappool/swap1 181,3 8 1843192 1843192
4. Iostat, vmstat với nhãn thời gian
vmstat 2 10000 |while read line; do echo "$line" "`date +%T`" ;done
Iostat -xnd 2 10000 |while read line; do echo "$line" "`date +%T`" ;done