Tuesday, December 18, 2012

Using ZFS under CentOS

Using ZFS

In my last post I showed how to get ZFS installed on CentOS 6.3. This post will serve as a quick start guide.

Creating a ZFS file system

The first thing you will want to do is to create a zfs file system. The syntax is simple and straight forward.
zpool create store mirror /dev/sda /dev/sdb
The above command creates a mirrored ZFS file system and mounts it at /store. That is the simplest use case you have a mirrored device that provides some hardware failure resilience.

Getting more complex

Creating a simple mirror is fine and good but lets show a little more complex example.
zpool create store raidz /dev/sdc /dev/sdd /dev/sde spare /dev/sdf
The above command create a RAID5 like ZFS file system and mounts it at /store. It also includes a hot spare drive. Other options other than raidz include raidz2 and raidz3 giving you even more redundancy.

You may want to create other ZFS file systems under your /store to give additional control  (for example setting quota's).
zfs create store/user1
zfs set quota=10G store/user1
Some of the other cool things you can do is turn on NFS sharing, enable compression or enable deduplication. To learn more about the more advanced stuff you can do with ZFS I recommend reading the ZFS Administrators Guide.

1 comment:

  1. Dude, ok... so like... ZFS for Linux released 0.6.1 this week. I installed it. It seems to work... but I have a few questions.

    1) When I reboot, some zfs process seems to nag a few times before it'll die. Is that normal?

    2) After I rebooted, my zfs pool(s) aren't automatically mounted. Is that something I add to fstab?

    3) If one is going to start using zfs hardcore, do you still want hardware raid cards in your servers?