I thought I would write something about my experiences of zfs as a system administrator, as I have been running it on my home server for a long time now (over a year). Other people will tell you about all about what is under the hood and how the checksums and whatnot works, but I'll give you my "user experience".
Before I started to use zfs on my
Shuttle SB51G
I had all my data (home directories, Solaris workspaces, etc)
stuck in one big UFS filesystem monuted on /export.
From where I loopback mounted directories to where I wanted them,
e.g. /export/local to /usr/local.
One of the things that annoyed the <beep> out of me with this approach, was that I constantly had to run
du to figure out what was hogging the disk. With zfs this problem is gone,
as filesystems are cheap and easy to create, I stick everything in its own filesystem,
and I can easily see where the culprits are. I'll show how to look for this below.
Since I started out with zfs a long time ago, I had to
bfu
to get access to zfs, and then I could to start out by backing up all my data (using tar).
Once I had my backups in a safe location I undid the lvm mirroring on my /export
partition and added the slices to a storage pool:
# zpool create p1 mirror c0t0d0s7 c0t1d0s7That's it! I just configured a mirrored pool, no more creating meta databases, mucking around with
md.cf
and running metainit.
When you use lvm you have to make an estimate on how much space you will need in each filesystem,
which can be very hard to do accurately. Now that we have storage pools you don't have to do that any more,
as all filesystems you create will dynamicaly use space from that pool. To prevent a single filesystem from taking up all available space in the pool, you can create quotas for filesystems, but more about that later.
Now I could take a look at the pool I just created:
# zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT p1 426.3G 0K 426.3G 0% ONLINE -
And if I want to see exactly how the pool is laid out:
# zpool status -v
pool: p1
state: ONLINE
config:
NAME STATUS
mirror ONLINE
c0t0d0s7 ONLINE
c0t1d0s7 ONLINE
Having a storage pool isn't enough, I needed some filesystems too, so I could restore my data:
# zfs create p1/home # zfs create p1/home/martin # zfs create p1/home/ftp # zfs create p1/localNow I have one container and three filesystems, which by default are mounted under
/zfs/p1/home and /zfs/p1/local
which isn't where I want them to be, so I have to modify that:
# zfs set mountpoint=/home p1/home # zfs set mountpoint=/usr/local p1/localand now they are and will always be mounted on those locations.
Two nice features of zfs are the quotas and reservations. On my anonymous ftp account I don't want people to be able to upload too much junk, so I place a quota on that filesystem:
# zfs set quota=10g p1/home/ftpAnd since I am greedy, I want to make sure I always have plenty of space in my home directory, so I give myself a nice little reservation:
# zfs set reservation=50g p1/home/martin
There is another cool feature in zfs which I use on all my Solaris source code workspaces, namely compression. I start out by creating a container to hold all my workspaces:
# zfs create p1/ws # zfs set mountpoint=/ws p1/ws # zfs set compression=on p1/wsNow every filesystem I create under p1/ws will have compression enabled:
# zfs create p1/ws/onnvso I won't have to go in and enable it for each new filesystem I create.
To verify that the settings are inherited from the p1 pool and p1/ws container I use:
# zfs get -a p1/ws/onnv PROPERTY VALUE SOURCE type fs - used 5.5G - available 385G - creation Mon May 30 2:37 2005 - referenced 27.5K - ratio 72.10x - mounted yes - recordsize 128K default quota none default reservation none default mountpoint /ws/onnv inherited from p1/ws sharenfs rw inherited from p1 checksum on default compression on inherited from p1/ws atime on default devices on default exec on default readonly off default setuid on default zoned off default
Now when everything was setup the way I wanted I just had to restore my data into the right locations and I was ready to start using zfs for real.
Once all the data was resored, I could easily see what was taking up the most space:
# zfs list NAME TYPE USED AVAIL MOUNTED MOUNTPOINT p1 ctr 41.3G 385G - /zfs p1/home ctr 35.8G 385G - /home p1/home/ftp fs 2M 10G yes /home/ftp p1/home/martin fs 35.8G 385G yes /home/martin p1/local fs 6G 385G yes /usr/local p1/ws ctr 5.5G 385G - /ws p1/ws/onnv fs 5.5G 385G yes /ws/onnv
The bottom line is: this is the only filesystem I use now, apart from UFS on my root partition (which is going to change). I am happy as a clam with zfs. It has made filesystem administration so much easier!
[Technorati Tags: OpenSolaris Solaris ZFS]





