Friday, January 16, 2015

mbuffer on FreeNAS + sending a recursive ZFS dataset

So I wanted to follow this procedure for doing a copy of a ZFS filesystem from one FreeNAS box to another. However, mbuffer isn't available for FreeNAS, and the devs aren't planning on adding it either. Fortunately, there is a working FreeBSD port of it available for install.

* Make sure you have SSH enabled on both systems. For this example, I'm assuming you're using the root user, or familiar with sudo users.
* On system #1, logged in via SSH, use wget to download an AMD64 version 9.3 or later copy of the mbuffer package.  At this time, that'd be the mhash-0.9.9.9_2.txz file.
* Also use wget to download the security/mhash package. At this time, that'd be the mbuffer-2014.03.10.txz file.
* Run pkg add -f (name of txz file) for each of the two downloads.
* Repeat the previous steps to download and install the txz files on system #2.

As for the procedure itself, it seems to get hung-up on redirecting the mbuffer output. Fortunately, there's a switch for silent operation. Here is the updated command to send a datapool and its recursive subvolumes to system #2, using SSH from system #1. You'll need to take a zfs snapshot beforehand.

zfs snapshot -r drivepool/dataset@snapshotname

zfs send -R drivepool/dataset@snapshotname | mbuffer -q -s 128k -m 1G | ssh root@system2 'mbuffer -q -s 128k -m 1G | zfs receive -F drivepool/dataset'

1 comment: