Monday, May 5, 2014

Moving My ZFS Pool to Ubuntu 14.04 LTS

Ubuntu 14.04 LTS is out! I’ve been waiting for the latest LTS release for a while now. Finally, I can synchronize the Ubuntu versions on my desktop and laptop. The way things are set up right now on my desktop, I have a single raptor drive that I use for the OS and SWAP partition, and a pair of 2 TB hard drives that are set up as a ZFS mirrored pool, which I mount as my /home folder. Having my /home directory on a separate drive from my OS has allowed me to update my OS easily in the past. However, this is the first time that I’ve done an Ubuntu update along with moving my new ZFS pool.

I found this website to be an awesome reference for a lot of what I am doing below.

First, we start off by trying to do an export of my ZFS pool using the command:

$ sudo zpool export -f tank

but this resulted in a warning, telling me that that I couldn’t unmount the pool because it was currently in use. As it turns out, when you set things up so that the ZFS pools is your /home directory, you run into issues like this. You can’t unmount the drive, because you’re using it when you’re logged in. In the end I decided to throw caution to the wind and just do the clean install of Ubuntu 14.04 on my raptor drive and worry about importing the pool later.

Setting up ZFS on your newly installed Ubuntu box is the same as before:

$ sudo add-apt-repository ppa:zfs-native/stable
$ sudo apt-get update
$ sudo apt-get install ubuntu-zfs

After that, it’s just a matter of importing the ZFS pool.

$ sudo zpool import -f tank

the -f will force the import to occur even though the pool is listed to be possibly used by another system. Remember how we didn’t actually export the ZFS pool? If you followed my previous article about setting up the zfs pool with the mountpoint at /home, then should also get a warning about not being able to mount the pool because /home is not empty. As before, we’ll do an overlay mount using the command:

$ sudo zfs mount -vO -a

followed by the command:

$ sudo zfs mount

tank                            /tank
tank/home                       /home

to to make sure that the ZFS file system was mounted in the correct spot. Huzzah! We’re back in business!


Written with StackEdit.