Warning This document is outdated, start with the FreeBSD Handbook's ZFS Quick Start Guide if you have not read it yet.

Ok, ZFS is now in the tree, what's now? Below you'll find some instructions how to quickly get it up and running.

April 8, 2008: Just because ZFS is in 7.0-RELEASE does *not* mean it works with the default GENERIC kernel! In fact, you are highly likely to experience kernel panics under any kind of load with ZFS and a GENERIC kernel. If you skipped reading Tuning Guide for ZFS, go back and do that before trying anything else in this document! While "tuning" may sound like something that is optional or perhaps only for performance, it is a requirement for stable FreeBSD 7.0-RELEASE ZFS.

December 2009: It is probably best to use ZFS only with FreeBSD 7.3 and newer versions.

With that said, on to getting started...

First of all you need some disks. Let's assume you have three spare SCSI disks: da0, da1, da2.

Add a line to your /etc/rc.conf to start ZFS automatically on boot:

Now, setup one pool using RAIDZ:

It should automatically mount /tank/ for you.

Ok, now we want to put /usr/ on ZFS and use some nifty file systems layout. I know you probably have some files already, so we will work on /tank/usr directory and once we are ready, we will just change the mountpoint to /usr.

Create ports/ file system and enable gzip compression on it, because most likely we will have only text files there. On the other hand, we don't want to compress ports/distfiles/, because most files in this directory are already compressed:

(You do see how your life is changing, don't you?:))

Let's create home file system and my own home/pjd/ file system. I know we use RAIDZ, but I want to have directory where I put extremely important stuff, so I'll define that each block has to be stored in three copies:

I'd like to have directory with music, etc. that I NFS share. I don't really care about this stuff and my computer is not very fast, so I'll just turn off checksumming (this is only for example purposes! please, benchmark before doing it, because it's most likely not worth it!):

Oh, I almost forget. Who cares about access time updates?

Yes, we set it only on tank and it will be automatically inherited by others.

Would be also good to be informed if everything is fine with our pool:

For some reason you still need UFS file system, for example you use ACLs or extended attributes which are not yet supported by our ZFS. If so, why not just use ZFS to provide storage? This way we gain cheap UFS snapshots, UFS clones, etc. by simply using ZVOLs.

Want to encrypt your swap and still use ZFS? Nothing more trivial:

/!\ WARNING: Due the way ZFS is currently implemented (also in Solaris), this might not work in low memory conditions (i.e. at those times you really need the swap space). See http://lists.freebsd.org/pipermail/freebsd-current/2007-September/076831.html for more information.

Trying to do something risky with your home? Snapshot it first!

Turns out it was more stupid than risky? Rollback your snapshot!

Ok, everything works, we may set tank/usr as our real /usr:

Don't forget to read zfs(8) and zpool(8) manual pages and SUN's ZFS administration guide.

For a more light-hearted introduction to ZFS' features, see this humorous presentation given by Pawel at EuroBSDCon 2007: http://youtube.com/watch?v=o3TGM0T1CvE


ZFSQuickStartGuide (last edited 2021-05-04T10:51:42+0000 by SashaVigole)