Ubuntu 12.04 Configuring Rsync
Rsync is a command line utility! If you don’t like command like you can find a GUI friendly utility called GRsync.
I personally use Rsync to backup certain areas of my Ubuntu server each week to my desktop PC and here is how i did it!
Rsync by default is already installed on most recent Ubuntu releases, (10.04 and up) we can go straight to configuration.
Note: This guide is specifically for running auto back ups from Ubuntu -> Windows 7 x64
1) First we are going create a script that will house the Rsync command that will preform the backup
sudo vi /home/draalin/rsyncbackup.sh
sudo rsync -avz –exclude-from ‘/home/draalin/exclude.txt’ / /main/pc/T1/$(date +”%m-%d-%y”)
2) Now we will create the exclude directory – meaning anything in this directory will not be backed up (These are completely up to you, I only choose these since they have a ton of stuff I don’t need or want to back up)
sudo vi /home/draalin/exclude.txt
3) Adding the script to the crontab (Process that will run the script at the desired time) – The following backs up every Monday at 6 pm
sudo crontab -e
* 18 * * 1 /home/draalin/rsyncbackup.sh
4) Creating the mount point area to where the Windows computer will be seen from Ubuntu
sudo mkdir /main/pc/T1
5) Finally auto mounting your computer (in my case my computer named “T1″) to the directory we just created so every time the Ubuntu server reboots it will be added
Note: The “\040\” is only needed if you have a space in your username like “John Doe” if your username was something like “Fred” it wouldn’t need it
sudo vi /etc/fstab
//192.168.1.191/Backup /main/pc/T1 cifs username=User\040Name,password=YOURPCPASSWORD 0 0
- Here is a guide on how to read and generate your own crontab control’s – http://www.openjs.com/scripts/jslibrary/demos/crontab.php