Can I mount a ZFS pool on another computer?

I've been playing with ZFS on a couple of USB sticks. So far I'm impressed! It seems nearly impossible to destroy your data. The order plugging in the sticks didn't matter. Yanking them out (well, not all of them at once, off course) still left the data readable. And restoring the zpool afterwards was easy enough. So I think about building a ZFS zpool from a couple of USB-HDD's. USB sticks have proven to work reliable with ZFS, so should USB HDD's.

There is however one problem. When I normally format a USB HDD, I can mount it on any computer that can handle the used filesystem. I was wondering if a zpool would do the same. So I created a zpool with two USB sticks, created a zfs partition on it, and put some textfile on it. I powered down the system, unplugged the sticks and plugged them in another FreeBSD system. To my surpise zpool status -v didn't see any zpools.

Is it possible to move a zpool to another computer? If so, how?
 
I've never tried it but you should at least do a zpool export on the 'old' system and a zpool import on the 'new' system.
 
You are right, zfs export and zfs import are the key.

Exporting a ZFS array isn't even necessary, but advised (I can't imagine otherwise...;) ) I was able to import the ZFS array on another FreeBSD system, without properly exporting it. So, in the extreme case I can't boot my original FreeBSD system anymore, I can still access my data. The other system first complained that the ZFS array probably belonged to another system and refused to import it. But it allowed an override with the -f option
[cmd=]zpool import -f myzfsarray[/cmd]
After that I was able to access and manipulate the date, which I did. I edited the textfile and exported the ZFS array properly this time.

Back to the original system. It still reported the zpool with [cmd=]zpool status -v[/cmd], so I deleted it. After that I plugged in the 2 USB-sticks and imported the zpool. This went smooth and without errors. The textfile had all the changes I made on the other FreeBSD system.

This little test increased my faith in ZFS even more. Can't wait to have my array up and running. :beergrin
 
You'll want to read through the zpool(8) and zfs(8) man pages, especially if you read them online for 9-STABLE (some major FreeBSD-isation of the man pages was done this month). Pay attention to the various incarnations of "import", and some of the options like -d to search for your harddrives in a specific spot (like /dev/gpt or /dev/label), and -R to roll-back a few transaction groups in case of minor disk corruption, and especially -o which lets you temporarily set pool properties for that one specific import.
 
Back
Top