Where to put ZFS filesystems in a pool
By user12625760 on Oct 27, 2006
Before we had ZFS, I was always telling people not not put things in the root of a file system. Specifically don't share the root of a file sytem. That way if you want to add another share to the file system later with different permissions you could and all was good. It was (is) good advice.
With ZFS you end up with lots of file systems and the advice does not hold anymore. Where previously you were trying to share the file system resources now you would just create a new file system in a pool and have done with it.
Today I realized that for ZFS there is some similar advice worth following and that is don't put all your file systems in the root of the pool. Todays example is that I have a number of file systems and one zvol in a pool. It would be nice to be able to use a single recursive snapshot to back up all the file systems but not the zvol, since that zvol is my swap partition. While a snapshot of swap is kind of cool in that you can do it serves no purpose other than to use storage at an alarming rate.
So now I have moved all the file systems under one uber filesystem called “fs”:
# zfs list -t filesystem,volume NAME USED AVAIL REFER MOUNTPOINT tank 84.9G 187G 26.5K /tank tank/fs 82.8G 187G 32.5K /tank/fs tank/fs/downloads 31.9G 187G 2.20G /tank/fs/downloads tank/fs/downloads/nv 26.9G 187G 37.5K /tank/fs/downloads/nv tank/fs/downloads/nv/46 2.49G 187G 2.48G /tank/fs/downloads/nv/46 tank/fs/downloads/nv/47 2.45G 187G 2.45G /tank/fs/downloads/nv/47 tank/fs/downloads/nv/48 2.55G 187G 2.45G /tank/fs/downloads/nv/48 tank/fs/downloads/nv/49 2.46G 187G 2.45G /tank/fs/downloads/nv/49 tank/fs/downloads/nv/50 2.52G 187G 2.45G /tank/fs/downloads/nv/50 tank/fs/downloads/nv/51 2.50G 187G 2.46G /tank/fs/downloads/nv/51 tank/fs/downloads/nv/tmp 12.0G 187G 4.78G /tank/fs/downloads/nv/tmp tank/fs/local 66.8M 187G 57.0M /tank/fs/local tank/fs/opt 1.67G 28.3G 25.5K /tank/fs/opt tank/fs/opt/SUNWspro 459M 28.3G 453M /opt/SUNWspro tank/fs/opt/csw 340M 28.3G 121M /opt/csw tank/fs/opt/sfw 907M 28.3G 880M /opt/sfw tank/fs/opt/spamd 110K 28.3G 24.5K /tank/fs/opt/spamd tank/fs/shared 12.1G 37.9G 28.5K /tank/fs/shared tank/fs/shared/music 5.71G 37.9G 5.70G /tank/fs/shared/music tank/fs/shared/pics 6.36G 37.9G 6.32G /tank/fs/shared/pics tank/fs/shared/projects 424K 37.9G 25.5K /tank/fs/shared/projects tank/fs/shared/projects/kitchen 376K 37.9G 46.5K /tank/fs/shared/projects/kitchen tank/fs/users 25.4G 74.6G 32.5K /tank/fs/users tank/fs/users/user1 300K 74.6G 29.5K /tank/fs/users/user1 tank/fs/users/user1 23.1G 74.6G 22.2G /tank/fs/users/user2 tank/fs/users/user3 13.5M 74.6G 9.72M /tank/fs/users/user3 tank/fs/users/user4 652M 74.6G 614M /tank/fs/users/user4 tank/fs/users/user5 1.12G 74.6G 987M /tank/fs/users/user5 tank/fs/users/user6 500M 74.6G 341M /tank/fs/users/user6 tank/fs/var 10.8G 19.2G 35.5K /tank/fs/var tank/fs/var/crash 5.10G 19.2G 5.09G /var/crash tank/fs/var/dhcp 128K 19.2G 30K /tank/fs/var/dhcp tank/fs/var/log 49.5K 19.2G 27K /tank/fs/var/log tank/fs/var/mail 871M 19.2G 179M /var/mail tank/fs/var/mqueue 662K 19.2G 24.5K /var/spool/mqueue tank/fs/var/named 442K 19.2G 369K /tank/fs/var/named tank/fs/var/openldap-data 130K 19.2G 82.5K /tank/fs/var/openldap-datatank/fs/var/opt 46K 19.2G 24.5K /tank/fs/var/opt tank/fs/var/samba 46K 19.2G 24.5K /tank/fs/var/samba tank/fs/var/tmp 4.90G 19.2G 2.45G /tank/fs/var/tmp tank/fs/web 920M 104M 2.56M /tank/fs/web tank/swap 45.1M 189G 45.1M -
I could have tweaked the mount point of tank to be “none” and of tank/fs to be “tank” but did not to avoid potential confusion in the future. I should really also ask that “zfs snapshot -r” have a -t option so you could get it to snapshot based on a type.