ZFS and swapping
ZFS is great. Obviously. Generally when I do a server I install system on UFS and then mirror disks with SVM. I keep data and apps on ZFS. That’s nice, especially if ZFS is on a SAN. If something happens with the server I can move ZFS pools to a different server, if necessary.
The server build process is just a preference. You can easily install Solaris 10 on ZFS and be done with it.
Not so long ago I ran into situation, where I needed to add some swap. For various reasons I did not want to shuffle slicing on system disks while system is running. Nor could I add a swap file on one of UFS filesystems. So The last option I had was to use one of the zpools:
bash-3.00# zpool status
pool: dudespool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
dudespool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c2t1d0 ONLINE 0 0 0
c2t2d0 ONLINE 0 0 0
errors: No known data errors
I was going to create a file to use it as swap area:
bash-3.00# cd /dudespool
bash-3.00# mkfile 50M swap
bash-3.00# swap -a /dudespool/swap
"/dudespool/swap" may contain holes - can't swap on it.
So that was that. As it turns out, ZFS can not be used for swap files. You have to create zvol and swap on that.
bash-3.00# zfs create -V 50M dudespool/swapvol
bash-3.00# swap -a /dev/zvol/dsk/dudespool/swapvol
bash-3.00# swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d10 85,10 8 1220928 1220928
/dev/zvol/dsk/dudespool/swapvol 181,1 8 102392 102392
There is more info on the net, just google it…