Tuesday, December 18, 2012

ZFS on CentOS 6.3

ZFS on CentOS 6.3

ZFS was orignally devolped by Sun in the early 2000's for the Solaris operating system.

What is ZFS

From Wikipedaia:
ZFS is a combined file system and logical volume manager designed by Sun Microsystems. The features of ZFS include data integrity verification against data corruption modes, support for high storage capacities, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z and native NFSv4 ACLs. ZFS is implemented as open-source software, licensed under the Common Development and Distribution License (CDDL). The ZFS name was a trademark of Oracle[3] until September 20, 2011.[4]

Building ZFS

Due to license restrictions ZFS can not be distributed with the Linux kernel.  That however does not mean that you can't install in on your machine, you just have to do it yourself. The ZFS on Linux project has done almost all of the leg work for you. You just need to build a few RPM files and install them.

SPL

To get SPL installed you need to do three basic steps:
  1. Download the source from http://zfsonlinux.org/
  2. Build the source
  3. Install resulting RPM files
Downloading the source
As of this writing rc-14 is the latest release. You can download it like this:
wget http://archive.zfsonlinux.org/downloads/zfsonlinux/spl/spl-0.6.0-rc14.tar.gz
Building the source
Install your build enviroment:
yum groupinstall "Development Tools"
yum install zlib-devel libuuid-devel libblkid-devel libselinux-devel parted lsscsi
Unzip your source and go to the directory:
tar zxvf  spl-0.6.0-rc14.tar.gz
cd spl-0.6.0-rc14/
 Compile the source and make the RPM files:
./configure
make rpm
Installing the RPM files
Finally install the resulting RPM files:
yum install spl-*.x86_64.rpm

ZFS

To get ZFS installed the same basic steps as above are followed.

Downloading the source
Again using rc-14
cd ..
wget http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-0.6.0-rc14.tar.gz
Building the source
tar zxvf zfs-0.6.0-rc14.tar.gz
cd zfs-0.6.0-rc14
Compile the source and make the RPM files:
./configure
make rpm
Installing the RPM files
yum install zfs-*.x86_64.rpm

Final Thoughts

ZFS is a very powerful file system. If you are like me you may not want a development environment on your production servers, just copy the resulting RPM files to the server and install them like normal. One thing to note is that ZFS is not quite ready to use SELinux so you must disable it. That will change soon but for now it has to be off in order to mount properly. In the next post I will show a quick guide to using it.