Monday, March 2, 2015

Installing ZFS on Amazon Linux

Now that zfs on linux is considered stable, it would make a great alternative to xfs or ext3/ext4 file systems. zfs is a volume manager and file system rolled into one. There are many excellent sites related to zfs, some of which you must peruse before you start:-

https://www.freebsd.org/doc/handbook/zfs-term.html
https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/
https://sysadmincasts.com/episodes/35-zfs-on-linux-part-1-of-2
https://sysadmincasts.com/episodes/37-zfs-on-linux-part-2-of-2

Once you have a good understanding of the benefits zfs offers, you can proceed with the installation. The below steps are relevant to Amazon linux:-


  • sudo yum update -y

After you run update on pkg manager, make sure your kernel and kernel headers are of the same version
***************
$ sudo rpm -qa |grep kernel
kernel-3.14.33-26.47.amzn1.x86_64
kernel-tools-3.14.33-26.47.amzn1.x86_64
kernel-headers-3.14.33-26.47.amzn1.x86_64
kernel-devel-3.14.33-26.47.amzn1.x86_64
***************
  • sudo yum remove -y <kernel-3.14.27-25.47.amzn1.x86_64 | old kernel>
  • sudo yum repolist enabled
  • sudo yum install -y gcc
  • sudo yum install kernel-devel zlib-devel libuuid-devel
  • download spl-0.6.3(http://archive.zfsonlinux.org/downloads/zfsonlinux/spl/spl-0.6.3.tar.gz)
  • download zfs-0.6.3(http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-0.6.3.tar.gz)
  • cd spl;./configure;sudo make && sudo make install
  • cd zfs;./configure --with-spl=/usr/local/src/spl-0.6.3; sudo make && sudo make install
  • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
  • edit /etc/sudoers and add /usr/local/sbin to Defaults secure_path variable
  • sudo modprobe zfs
  • $lsmod |grep zfs
***************
zfs                  1170768  0
zunicode              323435  1 zfs
zavl                    6874  1 zfs
zcommon                45353  1 zfs
znvpair                81478  2 zfs,zcommon
spl                   165402  5 zfs,zavl,zunicode,zcommon,znvpair
***************

  • now you can run zpool command to see if it works
***************
$sudo zpool status
no pools available
***************

2 comments:

  1. Hello,
    I am facing an issue when running "sudo modprobe zfs"
    I get the following error.
    modprobe: FATAL: Module zfs not found.
    And there are no logs in dmesg as well.
    I followed all your steps when trying to install zfs on aws ami.
    Can you please help me out.
    Thanks.

    ReplyDelete
  2. Hi WHen using below command , I am getting error: Any help or suggestion , Bit urgent:
    sudo zpool create -f alluxio /dev/xvda
    /dev/xvda is in use and contains a unknown filesystem.

    ReplyDelete