Here we go again.
After installing ZFS on a Debian based Proxmox Node I now need some bang on a CentOS Server.
To remind you all: ZFS on Linux is considerably stable and matured, but you put it in place on your own risk.
ZFS Native comes from http://zfsonlinux.org/
I use a Centos 6.3 minimal installation and I have a 2GB disk configured to it for demo.
fdisk -l Disk /dev/sdb: 2147 MB, 2147483648 bytes
And a Russian fellow describes his way to install it which I used and improved. http://habrahabr.ru/post/152853/ He build his own repo under http://yum.aclub.net/pub/linux/centos/6/umask-zfsonlinux/x86_64/ which is maintained as per 05.03.2013 So we start with:
cd /etc/yum.repos.d/ wget http://yum.aclub.net/pub/linux/centos/6/umask-zfsonlinux/umask-zfsonlinux.repo rpm --import http://yum.aclub.net/pub/linux/centos/5/umask/RPM-GPG-KEY-umask
There is an original repo from zfs on Linux now which we are going to use since it has the latest version 0.6.1 of ZFS http://zfsonlinux.org/epel.html
yum localinstall --nogpgcheck
If you don’t have yet enabled the EPEL repo please do now cause we need a pew packages from there. You can find details here or else: Obsulete since 08.2013 due to dkms in epel with a incompatible version
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
We now install DKMS and all necessary packages for building the kernel modules:
yum update yum install dkms gcc make kernel-devel perl
And now we come to the serious stuff … installing zfs ..
yum install spl zfs
That might take a while now depending on the machine performance since its compiling the packages.
You now better turn on ZFS in case you plan to reboot that server again.
chkconfig zfs on
That should do the jobs now. you can see it it works by running
# zpool status no pools available
Now lets configure some ZFS. For a deeper howto please refer for example to http://www.datadisk.co.uk/html_docs/sun/sun_zfs_cs.htm
It is advised to use if possible a full disk and let it hand by zfs rather than a slice.
# zpool create -f zfs-data /dev/sdb
zpool status shows what we just configured
# zpool status pool: zfs-data state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM zfs-data ONLINE 0 0 0 sdb ONLINE 0 0 0 # zfs list NAME USED AVAIL REFER MOUNTPOINT zfs-data 104K 1.95G 30K /zfs-data
In general you could now already use /zfs-data as a filesystem.
We can create underneath another filesystem.
We need to check first the permissions of /zfs-data it sometimes is set wrongly.
chmod 755 /zfs-data zfs create zfs-data/compressed
Lets quickly turn on compression.
zfs set compression=on zfs-data/compressed
zfs list NAME USED AVAIL REFER MOUNTPOINT zfa-data 141K 1.95G 30K /zfa-data zfa-data/compressed 30K 1.95G 30K /zfa-data/compressed
ZFS mounts the filesystems automatically when booting the system.
If you run yum update and the kernel gets updated then please follow the following steps to update zfs on Centos:
in some occasions after upgrading the kernel it might happen that zfs is not able to load zfs.ko and returns a
Load the module manually by running 'insmod /zfs.ko' as root.
Try the following to fix this. search first for your kernel version. (in this case you will see that I use a openvz kernel)
uname -a Linux oVirt 2.6.32-042stab077.7 #1 SMP Mon Apr 22 14:59:15 MSK 2013 x86_64 x86_64 x86_64 GNU/Linux
make sure you have the kernel headers installed.
yum whatprovides kernel-headers
search for 042stab077.7
install missing headers with
yum install vzkernel-devel-2.6.32-042stab076.5.i686
In this case I had to take an earlier version because there were no headers for 77 and then get with yum -y upgrade the latest version 078 for the kernel and its headers. Reboot to go to the latest version if this has changed
yum reinstall dkms spl zfs spl-modules-dkms zfs-modules-dkms
That should work now