Migrate ZFS pool to a different server
I hope you run your server with ZFS already :-)
For some reason you may need to migrate your ZFS pool with all snapshots to a different server. This could be a backup reason or simple a migration scenario.
In the example the pool named
zones. So first you create a recursive snapshot of your pool:
zfs snapshot -r zones@migrate_20160204
You could simple verify that the snapshots exists via:
zfs list -t snapshot
I use SSH to migrate the data between two servers. It depends on your network, so you could also switch to
netcat or something similar.
zfs send -R zones@migrate_20160204 | ssh user@host "zfs receive -Fd zones"
You may like to add options like
-v to show some more detailed output of the transferred data.
It could be your data is modified during the migration. For that reason you could easily create a new snapshot after the send and receive command finished.
zfs create -r snapshot zones@migrate_20160205
zfs send is possible with the
-i option. So zfs send only the difference between two snapshots to the remote server.
zfs send -R -i zones@migrate_20160204 zones@migrate_20160205 | \ ssh user@host "zfs receive -F zones"