Backup solution

This is not specific for the 5510 or elementary OS, but I’m happy to say that I finally managed to set up a backup solution that works just the way I always dreamed of. It consists of 2 parts:

  • CrashPlan
  • A small (crontabbed) shell script

In short, this is my view on backups:

Backing up is boring. Backing up is something you don’t want to think about. Backing up should just happen automatically in the background when the backup drive is available on the network.

This last sentence describes how I want backups to happen, and I finally found a way to implement it. CrashPlan is able to backup to a locally attached disk and at home I have a NAS unit that is connected to the LAN, and I have given it a name in the router so that it can be pinged just like any networked resource. Since the laptop is travelling I can’t keep a line in fstab that mounts it permanently, but I set up a very small script that runs every 5 minutes to check if the NAS is available and if so, mounts it:


if [ $(mount | grep -q ${NAS_NETWORK_NAME} && echo 0) ]; then
 echo "${NAS_NETWORK_NAME} is already mounted"
 mac_address=$(arping -c 1 ${NAS_NETWORK_NAME} | grep "reply from" | awk '{print $5;}')
 if [ "$mac_addr" = "${NAS_MAC_ADDR}" ]; then
 mount -t cifs //${NAS_NETWORK_NAME}/somepath -o username=someuser,password=somepassword /mnt/${NAS_NETWORK_NAME}

So I arrive home, and start the laptop. Within a couple of minutes the NAS is mounted, CrashPlan disovers that the destination is available and the backup starts running without me lifting a finger. Just like I want it.

Leave a Reply

Your email address will not be published. Required fields are marked *