Simple backups for non-tech users with udev


We are using SharePoint 2010 Foundation SP2 as our EDM system. Every day we are making backups of our EDM system on external hard drive. A week ago our CEO has decided to has a second copy of the archives and keep it into a safe.

No sooner said that done!

Let's make criterias of future backup system:

  • it must be automatic
  • it can do everyone, even non-tech users
  • it must do ONLY onto specific external hard drive

So, what is a system doing? System consists of the following components: a udev rule and a bash script, which run when you insert the concrete external hard drive into destination host. Also, the system depends on the following system packages: cifs-utils, at, ntfs-3g.

Backups of our EDM system is lying on a Windows (SMB) share. When the external hard drive is inserted, the bash script will be runned and will create an `at` job. The `at` job at the specific time (by default 11pm on Saturday) will remove all content on the hard drive, then copy all files and folders from the Windows (SMB) share to the external hard drive.

Source Code

The source code is available at GitHub and distributed under MIT License.


As every backuping system, our system also need a some bit of configuration. First of all you need to install the system's required packages:

sudo apt-get install git-core cifs-utils at ntfs-3g -y  
git clone && cd udevbackup  
Second you need obtain your external hard drive serial number. To obtain serial number run:
sudo udevadm info --query=all --attribute-walk --root /dev/sdb1  
The next phase of configuraion:
HARD_SERIAL=<your hard serial is obtained from the previous step> SMB_DOMAIN=<domain.local> SMB_SHARE=<//server/share> SMB_USER=<user> SMB_PASSWORD=<password> make configure  

To install just run the following in a terminal:

sudo make install