Migrating a file server with zfs
At the company I'm working for we have a central NAS. This NAS contains all user homes, backups and such. It is a small box with four HDDs running a FreeBSD on a ZFS RAID-Z2. Recently we switched to newer hardware. Transferring the data traditionally takes 13 hours - a big time frame. I can't shut down the server for 13 hours, working hours are from 07:00 o'clock to 21:00 o'clock. Gladly we use ZFS! I created a snapshot and sent it to the new server:
zfs snapshot zroot/var/storage@base
zfs send zroot/var/storage@base | ssh 10.0.0.24 zfs receive zroot/var/storage
This took round about 13 hours. But during that time the users could
work normally, due to the snapshot the changes did not interfere with
the zfs send
. When it was finished I waited until 21:00, created
another snapshot and sent only the difference to the new server:
zfs snapshot zroot/var/storage@latest
zfs send -i base zroot/var/storage@latest | ssh 10.0.0.24 zfs receive -F zroot/var/storage
After that I shut down the old server, set the IP on the new server to the IP of the old one and voila - everything works as expected! The actual switch took me just 10 minutes.
ZFS really rocks :)