This should work on any version of Linux, although it has only been tested on (Ubuntu) Jaunty Jackalope and (Ubuntu) Karmic Koala.
If using on a non-Debian Linux system, the commands here given for installing the software are not applicable. Please consult your distribution if you do not know how to install software.
I am going to show you how to back up your home directory (/home/username) to a remote drive shared on the network (ex. Lacie Ethernet BigDisk - 1TB) along with a list of installed packages and a list of sources.
Prerequisites:
Step 1: Open up a Terminal window (Applications->Accessories->Terminal - don't be afraid ) and keep it open for the duration of this tutorial.
Step 2: Paste the following code into the Terminal window:
Code:
sudo aptitude install smbclient smbfs
Setting up the backup:
Step 1: Configure your network drive properly and make sure you can connect to it from the computer you wish to back up. Also record the IP Address of the network disk. I am sorry, but I cannot help you set up your network drives. There may be threads on the forum that can help you if you are having problems.
Step 2: Create the mountpoint for the backup drive by pasting the following into the Terminal window you left open:
Code:
sudo mkdir /mnt/backup
Step 3: Open up a new Text Editor window (Applications->Accessories->Text Editor)
Step 4: Copy the code below into the Text Editor window and save it as a shell script (File->Save As...->Select shell script as the file type):
Code:
#!/bin/bash
cd
yes "your password here" | sudo -S cp /etc/apt/sources.list .
dpkg --get-selections > installed-software
yes "your password here" | sudo -S smbmount //IP address/share name /mnt/backup -o username=username,password=password,uid=1000,mask=000
#username and password are optional, so only input them if necessary.
rsync -arquz --exclude=Music --exclude=Videos --exclude=Pictures --exclude=Dropbox --exclude=Examples --exclude=.VirtualBox --exclude=.beagle --exclude=.cache --exclude=.icons --exclude=.evolution --exclude=Skype\ Calls --exclude=tabla\ lessons --exclude=.thumbnails --delete /home/chiraag /mnt/backup/
yes "your password here" | sudo -S smbumount /mnt/backup
exit
Rsync options: a = archive (not sure what this does , but leave it on), r = recurse into directories, q = quiet (recommended - otherwise your Terminal window will fill with junk ), u = update (skip files that haven't been changed), z = compress (makes network backups faster, recommended)
Step 5: replace the bolded items only!!!!! with appropriate values. For the rsync options, I would just change which paths you want excluded and maybe remove the option. Keep in mind, if you delete the option, no files deleted on your computer will be deleted on the back up hard disk!!! This can lead to unnecessary bloating of your backup. Finally, make the script executable with
Code:
sudo chmod +x /path/to/backup/script/you/just/created
Replace /path/to/backup/script/you/just/created with the actual path. To figure out this path, go to Places->Home and browse to the folder which contains the script. Then, click on the little icon next to the buttons which show where you have been (the tooltip should say something pertaining to location). The full path should be shown with slashes (/) between folder names. Copy this long thing and paste it into the terminal instead of the /path/to/backup/script/you/just/created.
Step 6 [optional]: Install "Scheduled Tasks" with
Code:
sudo aptitude install gnome-schedule
(paste the code into the Terminal window) and schedule your backup script to run however often you wish!
TO RESTORE: Simply change the rsync command in the script to read
Code:
rsync -arquz --delete /mnt/backup/ /home/chiraag
KEEP IN MIND: IF YOU KEEP THE --delete OPTION, IT WILL DELETE ALL FILES THAT WERE NOT BACKED UP. PLEASE TAKE CAUTION WHEN USING THIS WITH THE RESTORE SCRIPT. That's all, folks!
- Chiraag
Bookmarks