Migrating Data to new FreeNAS Hardware

FreeNASI’ve been using FreeNAS for many, many years. I believe I started back in the .6 beta days, which if memory serves would have been somewhere around 2009ish? Over that time, I have had a handful of machines doing the work – three if I’m not missing anything. Power-related issues killed the first two (PSU / board death on one, and blown capacitors on another). I then scraped together some ‘old’ hardware at the time and built what is now my ‘current’ FreeNAS box. It is comprised of a whopping Pentium Dual-Core E6500 CPU and 4 GB of RAM. The real kicker is that it is running on a single 1.5 TB SATA drive.

Hopefully that last bit stands out. FreeNAS uses ZFS as its filesystem, which is incredibly resilient and feature rich. But, that resiliency only goes so far when you only have one drive. I recently came into some ‘newer, but older hardware’ that I am moving the install over to. This one isn’t a speed demon by any means (Pentium i3 530), but I have 4 x 1 TB SATA drives in this one, setup in an RAIDZ1 configuration. So at least going forward, I’ll have some sort of protection.

Are you crazy!? One drive?

FreeNAS View DisksI recently got a lot of flack about this (you know who you are … it was worth it to see your reaction 😉 ), but it was a conversation that I enjoyed as the concept seemed completely ludicrous – a bad sector could pooch all my data. Honestly, I have taken some measures to safeguard the data, particularly photos. The FreeNAS box contains a lot of media (videos, photos, software, etc.), but with the exception of photos, just about all of it could be downloaded again.

Photos on the other hand, likely can’t be downloaded again. For this, I use Google Photos which backs up all my pictures to ‘the cloud’. What’s nice about it is that I can integrate it into my Google Drive, as well as install the app on my iPhone. The iOS app will automatically upload pictures to Google Photos, which saves a step, but just keep that in mind when taking pictures. So, how do I backup pictures on the FreeNAS? I installed the client on a desktop, mapped a network folder to the photos directory on FreeNAS, and let it backup for a couple of days.

Moving the data

Now that I have (hopefully) rationalized my ‘risky’ setup, how do we actually get the data from box A to box B? First up, you’ll want to backup your FreeNAS config. This will grab things like your network settings. Next up, if possible, you can actually just yank the drive(s) from the old machine, pop them into the new machine, and import the ZFS pool. ZFS isn’t tied to a RAID controller, so you actually get some ‘freedom’ in this regard.

If that isn’t an option then I would suggest replication. ZFS supports snapshots, which it can then replicate to another receiving host. FreeNAS supports this feature set via the GUI, but I opted to run it from the command line. I tried initially via the GUI, but honestly, I felt like it was too many steps (and some of that may have been me missing a configuration option).

To manually kick of the replication:

  • SSH into host A (the source)
  • Run ‘tmux
    • This will run an application that spins up a new virtual console window. The nice thing about this terminal window is that you can disconnect from it and the command will keep running in the background. To reconnect, just run ‘tmux attach‘ to bring up the console.
  • Create a snapshot (zfs snapshot [email protected])
  • Replicate the snapshot. Note that the IP address is the destination host. (zfs send [email protected] | ssh 192.168.1.2 zfs receive Tank/Data)
  • Monitor copy progress – you can run ‘zfs list‘ to list the current zfs datasets, and check their sizes.

Anything else?

Once this was done, I applied the backup config, gave the FreeNAS a reboot, things came up fine. If you are using jails (under their own ZFS pool), I would suggest stopping the jail(s), take a snapshot, and then use replication. Less moving parts means less of a likelihood of issues.

So, why didn’t I just rsync the data? Well, for one, the config restore process is much easier for actual ‘system stuff’. But another issue that I stumbled into was jails, specifically those with symbolic links. rsync was seeing those symbolic links and copying the same files over. In my case, I have three or four jails which all have a symbolic link to the same folder. This specific (and large) folder was being copied in full, each time, for each jail. ZFS snapshots, on the other hand, solved this issue.

This is by no means an in-depth ZFS article, but it wasn’t meant to be. Rather I was hoping to provide some basic steps to move to new hardware. I know that when I was looking for a solution, I couldn’t find anything concrete – this has seemed to have worked out for me thus far.

One thought on “Migrating Data to new FreeNAS Hardware

Leave a Reply

%d bloggers like this: