The better way to run CrashPlan on your FreeNAS…
With the 9.10 version of FreeNAS, comes a better way to virtualize functionality on your FreeNAS server. It also allows us to move away from the headaches we have seen with the Jails, particularly with the CrashPlan. The CrashPlan jail has required too many hours of tinkering with every upgrade, and after seeing everything break with the release of CrashPlan version 4.8, I decided there must be a better way to back up my data on my NAS.
The solution resides with Iohyve – a built in hypervisor that allows you to run virtual machines.
The first step is to ssh into your FreeNAS installation and identify the zpool you wish to install your virtual machine on – I have added a separate pool running on an SSD disk within my environment, and named the SSD storage zpool “SSD”.
Identify the correct zpool name in your environment.
Next, run the setup of iohyve on your identified zpool:
iohyve setup pool=SSD
You also need to identify the correct interface, to bridge your VM to:
Once identified, set the interface to bridge your VM to, and set the correct kernel module to load:
iohyve setup net=alc0 kmod=1
Now create the ubuntu host (named ubuntu_crashplan), allocating 20GB of disk space:
iohyve create ubuntu_crashplan 20G SSD
Next we need to set the correct parameters for Ubuntu, first allowing to boot with grub, set the OS as debian based, configure the RAM, CPU count, and the con parameter (adjust RAM and CPU as needed):
iohyve set ubuntu_crashplan loader=grub-bhyve os=debian ram=1024M cpu=1 con=nmdm1
Now we need to fetch the ISO to install (or copy the link to your preferred version of ubuntu):
iohyve fetchiso http://releases.ubuntu.com/16.04/ubuntu-16.04.1-server-amd64.iso
Then install the ISO image
iohyve install ubuntu_crashplan ubuntu-16.04.1-server-amd64.iso
Give the installer a minute to start, then open up a second SSH session to your FreeNAS, and run the console command to connect to the new virtual machine:
iohyve console ubuntu_crashplan
Step through the installer as normal, but once you arrive to the software selection screen of the installer, you may choose “OpenSSH server” to allow direct access to the virtual machine.
Once the installer completes, reboot the new virtual machine.
Verify the status:
Start the virtual machine:
iohyve start ubuntu_crashplan
Set a static IP if you prefer, or set a DHCP reservation within your firewall. Then either SSH into your new ubuntu server or use the “iohyve console ubuntu_crashplan” command to gain access.
We have several considerations, before implementing CrashPlain:
- What paths do we want to mount?
- What file system do we use to mount these paths?
In my environment, I will be making the following mounts, with the mkdir command:
We will then need to mount the appropriate folder to be backed up on the FreeNAS to the created mount points.
Example mounts of shares using CIFS
In my example, I am going to use CIFS and a separate service account to mount to the share:
sudo apt-get update sudo apt-get install cifs-utils
Create a samba user:
sudo nano /etc/samba/user
Create (2) lines in the credentials file (I created an account with read-only permissions within FreeNAS for the SMB share)
Use “control+o” to write the file, and “control+x” to exit from Nano.
Set the new user file to read only:
sudo chmod 0400 /etc/samba/user
Backup your fstab file:
sudo cp /etc/fstab /etc/fstab.bak
Edit your fstab file:
sudo nano /etc/fstab
We will need to add the various mount points on your FreeNAS with their associated path on your CrashPlan server. Please note that if you have a share name with a space, you must substitute the space with “\040” in your fstab file. For example:
//192.168.1.10/FreeNAS/Music\040Videos/ /mnt/Music_Videos/ cifs crednetials=/etc/samba/user,noexec 0 0
Suggestion: You will want to map out a restore folder to your NAS. That will direct downloaded files to your NAS instead of the 20GB virtual machine disk. For example, I created a /mnt/Restore directory on the CrashPlan VM that maps to a Downloads folder on my NAS.
Enter your mount points and mappings, and reboot your server to test. Once everything is mapped out correctly, you can install CrashPlan:
cd /tmp/ wget https://download.code42.com/installs/linux/install/CrashPlan/CrashPlan_4.8.0_Linux.tgz tar -xzf CrashPlan_4.8.0_Linux.tgz cd /crashplan-install/ sudo ./install.sh
Now we should be prompted with the CrashPlan installer. Use the defaults, except for the incoming backup data. I created a /mnt/Restore mapping in my example:
Once completed, some useful information:
Allow the server to listen to external connections:
sudo nano /usr/local/crashplan/conf/my.service.xml
Identify and change from:
Copy the key from your Headless CrashPlan .ui_info file, and double checking the listening port:
Into your local .ui_info on your computer.
This varies by operating system, so please refer to CrashPlan’s site for the file locations at:
Once done, your client will have a .ui_info file that shows the correct port, the correct key, and the IP of the new virtual server. The virtual (and headless) server’s .ui_info will show the IP as 0.0.0.0 after we configure the my.services.xml file.
Complimentary .ui_info files – client on the left, server on the right:
Once these are in agreement, restart the crashplan service on the virtual server:
sudo service crashplan restart
Launch the local application from your machine with the correct .ui_info, and you should attach!
With this replacing a previous CrashPlan Jail, I simply adopted this computer after the login to replace my previous setup. All mount points were named to replicate the setup in the replaced FreeNAS jail.
Once you have connectivity between your client and your host, you can lock each .ui_info file with the immutable bit. For the Ubuntu Crashplan server, use:
sudo chattr +i /var/lib/crashplan/.ui_info
For OS X, use:
sudo chflags nouchg /Library/Application\ Support/CrashPlan/.ui_info
This will lock both files, and prevent edits. To unlock the files, change the chattr attribute to “-i” (instead of +i) and the chflags attribute from “nouchg” to “uchg”.