Monday, January 26, 2015

Backing Up My FreeNAS Server

I run my FreeNAS as a VirtualBox VM, with VirtualBox running on Oracle Enterprise Linux 6.5.    This has created a bit of a stability problem as sometimes the VM will crash or be a victim of a power outage.  Anytime the the VM goes down unexpectedly, there is risk that the virtual drive, VMDK in my case, will get corrupted.  At any rate, backing up your backup is a good DR policy.  I have chosen to use the following strategy:

1.  Use the CRON job process in FreeNAS do an RSYNC between the VMDK drive and my host OS (OEL6.5).  This will get my files out of the VMDK and onto a separate drive mounted on OEL6.5.  RSYNC is feature rich allowing me to copy only files that have been changed.

Here is my RSYNC script on the FreeNAS system:





Since this script will need to automatically login to my host OLE6.5, I'll need to setup passwordless login for SSH.  I do this using the following commands:
jsmith@local-host$ [Note: You are on the guest VMBox FreeNAS system here]
jsmith@local-host$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host

Now Copy the SSH Key to my host OEL6.5 keystore:
cat /home/jsmith/.ssh/id_rsa.pub | ssh root@192.168.1.250 'cat >> .ssh/authorized_keys'


2.  Once I get the files onto the OEL6.5 mounted volume, I use CrashPlan to upload the files into the CrashPlan cloud.  CrashPlan has a nice GUI (Java) and is one of the few that supports all platforms, including Linux.  They are also surprisingly economical;  $59/year for unlimited space.

3.  Finally I purchased a CyberPower UPS (CP1350AVRLCD) to protect against surprise outages and to regulate my AC power.  This was a pretty good deal for $125.  This is the only one I could find that has Linux compatible software for shutdown and monitoring.