Native ZFS for Linux on Proxmox

Native ZFS for Linux on Proxmox

Native ZFS for Linux on Proxmox
With ZFS on Proxmox you will realized a very huge disk speed advantage within your virtual machines.
In this post I will explain you howto setup Native ZFS for Linux on Proxmox.

For my Setup I used two Hard Disks with the following Size:

DiskSizePath
WDC WD20EARX-00P2 TB/dev/sda
WDC WD20EARX-00P2 TB/dev/sdb

Surely you could also add some more or SDD Disks for extra Caching.

 

First of all, get you system up to date:

apt-get update && apt-get upgrade -y

 

Install following utilities/dependencies to your System:

apt-get -y install autoconf libtool git
apt-get -y install build-essential gawk alien fakeroot zlib1g-dev uuid uuid-dev libssl-dev parted  pve-headers-$(uname -r)

 

grab the latest source directory of SPL compile and install the compiled .deb packages:

cd /opt
git clone https://github.com/zfsonlinux/spl.git
cd spl
./autogen.sh
./configure
make deb
dpkg -i *.deb

 

check if spl loads correctly by entering:

modprobe spl

 

now do the same with ZFS source:

cd /opt
git clone https://github.com/zfsonlinux/zfs.git
cd zfs
./autogen.sh
./configure
make deb
dpkg -i *.deb

 

check if zfs is working:

modprobe zfs

 

now add the init script to your system:

update-rc.d zfs defaults

and reboot your system:

reboot

 

After reboot we are ready to build our Storage Pool:

zpool create -f -o ashift=12 storage mirror /dev/sdb /dev/sda

And add some tunings:

zfs set compression=on storage
zfs set sync=disabled storage
zfs set primarycache=all storage
zfs set atime=off storage
zfs set checksum=off storage

Important Caution note:
Deduplication feature requires up to 5 GB RAM per Terrabyte Storage Space, so if you cannot afford this amount of exclusive RAM disable dedup by entering:

zfs set dedup=off storage

 

List your Pool created before:

zpool list storage

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
storage 1.81T 20.5G 1.79T 1% 1.00x ONLINE –

If you see something like this above we are Done!
Finally add your newly created Pool /storage to you Proxmox GUI. When adding new VM’s don’t forget to use RAW disk images and write back for your virtual disks as cache feature to get the huge speedy advantage of your zfs pool.

Update
If ZFS eats your memory and you ran out of it here is my solution: If ZFS eats your memory

Another problem solution
If you encountered a problem that daemons seems fail to start on server boot up,
here is the solution: configure zfs zo start before proxmox

Rating: 5.0/5. From 1 vote.
Please wait...
Jules

Jules

Jules is the owner and author of ISPIRE.ME. He's a Linux System Engineer, Tech fanatic and an Open Source fan.

You may also like...

3 Responses

  1. Roman Shein Roman Shein says:

    Unfortunately, it will not speed up VM boot as l2arc is not persistent 🙁

    No votes yet.
    Please wait...
  2. Roman Shein Roman Shein says:

    Proxmox has built in backup feature. Does it work with ZFS?

    No votes yet.
    Please wait...
    • Jules Jules says:

      Of course it will since you can store backups wherever you want if you define the backup target path.

      No votes yet.
      Please wait...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.