Migrating FreeNAS ZFS Pools to Ubuntu
Table Of Contents
I wanted to migrate my ZFS Raid-Z2 Pool from my FreeNAS to a new Ubuntu 18.04 since I wasn’t happy with FreeNAS anymore and starting with Release 18.04, Ubuntu has a good ZFS support now.
Turned out it’s pretty simple to do.
Requirements
All you need is two drives:
- One for the Ubuntu image (must be version 18.04 or newer) to boot the live system from (e.g. USB Flash Drive)
- The drive that will actually have the Ubuntu installation on it later.
To minimize all risks of loosing any data I kept my old FreeNAS data on an extra USB Flash Drive to easily roll back if something would not work.
Preparations on Ubuntu
- Install the Ubuntu image on the USB Flash Drive. I used balenaEtcher.
- Install Ubuntu from your Image on the correct drive (Of course make sure not to overwrite your storage drives).
- Setup Ubuntu and after the first boot install pending updates:
sudo apt update && sudo apt dist-upgrade -y
- Now install dependencies and the ZFS components:
sudo apt install software-properties-common linux-headers dkms
sudo apt install zfsutils-linux
Importing the ZFS Pools
- Search for existing ZFS pools:
sudo zpool import
- Import the ZFS pool:
sudo zpool import -f <POOLNAME>
- Check if the zpool is mounted and everything is okay:
sudo zpool status
Now the ZFS Pool is mounted like it was on FreeNAS!
You can now find all your mounted ZFS pools with informations about them by typing
zpool list