Hypothetical ZFS snapshot question

I have a home server running FreeBSD 9.0 with ZFS with a single drive. I was thinking about building a new box, I'm running on very old hardware and it works great for what I need it for but I'm starting to expand on what I use and I'm seeing performance issue. If I build a new box with 2 or more drive and install FreeBSD 9.x on it, is there a way to take a snapshot/cloan the system so I can dump all of my data on to the new system. Files, apache config, samba, etc? If not what is the best way to move data over to a new system.
 
ZFS has the ability to send snapshots which can be imported as a filesystem, volume or snapshot. By utilising for instance ssh(1) this can be done to zpools on remote machines. Refer to the man page for zfs() and specifically the send/recieve subcommands. Towards the end there are some examples, one which does exactly what you're looking for.
 
Depending on the exact setup and available ports there's also the possibility of connecting a new drive to the old system, partition it, add bootcode and 'zpool attach' it to the original pool to make a mirror (DO NOT RUN 'zpool add'). Then take it out and place in the new machine. It should boot (if you had root-on-zfs) degraded due to the missing drive but then you can replace the missing drive with the other new one. It should be fairly easy at this point to get ZFS to pickup any extra space on the disks.

(That's if you don't mind the new system being an exact copy of the old, rather than a new install with the old data).
 
Using zfs snapshot -r, zfs send -R and zfs receive -F you can clone an entire dataset and all its snapshots, descendents, clones and properties, so if you do that on the root filesystem in the pool and you also boot from ZFS, then you're done (actually, don't forget to set the bootfs zpool property on the new system if your boot files do not reside on the root filesystem). I actually did this this week to copy an entire pool over to a new set of drives, works great.

If you boot from another filesystem you have to copy this one separately.
 
Back
Top