Linux – Using ZFS or XFS on a Xen guest running Linux

linodelinuxxenxfszfs

Background:

I'm investigating the viability of using a filesystem other than ext3/4, with the ability to run snapshots for backup and rollback purposes. The servers under consideration are mailbox server nodes running on Linode's Xen based VPS platform. I'm particularly drawn to the various published benefits which ZFS offers in terms of data integrity and this year's stable release of native ZFS support in Linux – http://zfsonlinux.org

ZFS appears to be the more thorough option in terms of benefits and simplicity (instead of LVM+XFS). Please note that I have little experience with ZFS (which I use on a local FreeNAS installation) and none with XFS, hence the post. To date, my servers are using ext3 filesystems, not managed under LVM.

Question in detail:

So, I have two questions.


(1) Which of the two filesystems would be the better choice for the best of all of the following 3 aspects, running on a Xen Linux guest?

  • Snapshots
  • Data Integrity
  • Performance

(2) If ZFS is a viable option, is it practical to use RAIDZ across Xen disk images to further enhance the solution for data integrity?


Note: I'm reluctant to consider BTRFS, given the many warnings I've read about in using it on production systems.

Best Answer

There's no reason that you couldn't use either of those solutions on your Linode, but it will make your Linode incompatible with any Linode-managed disk services. Linode only supports ext3; no Linode backups, no disk resizes, might have an impact on migrations (although I suspect that one works on the disk image level). It's up to you if the benefits of ZFS outweigh the downsides. You can do some neat stuff with a copy-on-write filesystem, like real snapshots rather than the weird hacky thing LVM does.

In terms of using raidz, there's no real benefit except perhaps saving space. All your disk images will be on the same raid10 volume on your Linode's host machine, so it makes more sense to use ditto blocks rather than raidz. ZFS keeps multiple copies of certain blocks: three copies of global metadata, two copies of filesystem metadata, and one copy of user data. You can set the "copies" property on a ZFS filesystem to control the number of user copies. If you set it to 2, all user data will be duplicated, and it bumps other two values by one as well, capped at three (so 3 copies of filesystem metadata). This can be set on a per-filesystem level, or the whole pool, so you can pick what data is important enough to mirror.

ZFS will try to keep the ditto blocks as far away from each other as possible. Different vdevs if the pool has multiple vdevs or at least 1/8th of a vdev apart if it's just one vdev (as your Linode would be).