A look at MySQL on ZFS
Added 31 Jul 2008
About ZFS
When Sun Microsystems released the ZFS filesystem in 2004, they set out to remove all of the practical limits on filesystem storage, and to make the arcane details of storage management a thing of the past. ZFS is a 128-bit filesystem with – to name just a few features – copy-on-write transactional semantics, fast snapshots, and optional compression.
The most obvious benefit of ZFS is its simple administration. In ZFS, traditional tasks like formatting a disk or editing /etc/fstab are gone entirely, and building a mirrored or striped RAID can be accomplished with a one-line command that actually looks sensible, is easy to remember, and has interactive help. ZFS does for storage management what MySQL did for databases, and like MySQL, it's open source, as well. ZFS was first introduced in Solaris, but Linux ports are underway, Apple is shipping it in OS X 10.5, and it will be included in FreeBSD 7. For more details on ZFS in general, see the ZFS Community page at opensolaris.org.
Most ZFS administration relies on two commands: zpool, for managing storage pools, and zfs, for filesystems. The storage pool is a key abstraction: a pool can consist of many physical devices, and can hold many filesystems. Whenever you add storage to the pool, it becomes available to any filesystem that may need it. To take a newly-attached disk and use the whole disk for ZFS storage, you would use the command
# zpool create zp1 c2t0d0
Here, zp1 represents the name of a pool, and c2t0d0 is a disk device. If the Solaris-style volume name looks unfamiliar, note that on Linux and other OSes, the commands will use native device names.
If you have a disk had already been formatted – say, with a UFS filesystem on one partition – you can create a storage pool from another free partition:
# zpool create zp1 c2t0d0s2
You can even use a plain file for storage:
# zpool create zp1 ~/storage/myzfile
Once you have a storage pool, you can build filesystems on it:
# zfs create zp1/data # zfs create zp1/logs