Topic: [Solved] Backing up with grsync

First off, sorry for all my questions, it feels like I'm asking questions over and over again. I appreciate your input and  the fact that you stay nice smile

That being said, in my previous topic I asked for some backup tools. I have chosen Grsync, but I have two small questions:
1. I want to do a full system backup. I want to back up /, including all permissions, settings and everything; so that if I restore the backup I get the system just as I have it now. Which options would I have to set? And when doing this, do I have to run grsync as root or normal user?
2. Solved Exclude directories. I didn't find an option for this, but maybe it's hidden in some place I don't know about. I don't want to backup my music, movies, documents and photo's, because I do this manually. If this option isn't available, I can live with it though.

Thanks again for your help big_smile

Last edited by Unia (2010-09-03 13:19:31)

Let's do it and don't screw it.
      Github || Deviantart

Re: [Solved] Backing up with grsync

Unia wrote:

First off, sorry for all my questions, it feels like I'm asking questions over and over again. I appreciate your input and  the fact that you stay nice smile

That being said, in my previous topic I asked for some backup tools. I have chosen Grsync, but I have two small questions:
1. I want to do a full system backup. I want to back up /, including all permissions, settings and everything; so that if I restore the backup I get the system just as I have it now. Which options would I have to set? And when doing this, do I have to run grsync as root or normal user?
2. Exclude directories. I didn't find an option for this, but maybe it's hidden in some place I don't know about. I don't want to backup my music, movies, documents and photo's, because I do this manually. If this option isn't available, I can live with it though.

Thanks again for your help big_smile

For your home directory you will need to create an exclude file.

/home/yourusername/.grsync/exclude

Then add your directories and files one line at a time without the paths.

music
movies
documents 
photos
.thumbnail
Trash
.cache

Then In Grsync > Andvanced Options> Additional Options  add the following.

 --exclude-from=/home/yourusername/.grsync/exclude

Be sure to replace yourusername with your actual username and run simulate to ensure all is correct.

Last edited by kukibird1 (2010-09-02 18:32:08)

Re: [Solved] Backing up with grsync

Alright thanks, that makes question 2 solved! What about question 1?

Let's do it and don't screw it.
      Github || Deviantart

Re: [Solved] Backing up with grsync

Re #1, you'd definitely have to do it as root. I've used rsync (which grsync is based on I think) to back up system stuff (/etc folder etc) this way. Whether you can just back up your whole / system this way and get it back later I'm not sure. I've never tried it and there may be complications. More sophisticated apps like remastersys exist for this kind of thing, but you'll need input from someone more knowlegable there...

John
------------------------
( a boring Japan blog , and idle twitterings )
“Good morning sir, which way up would you like your reality today?”  "As it comes, Jeeves, as it comes..."

Re: [Solved] Backing up with grsync

Unless you're really set on rsync, you might look into using tar to make compressed archives of your base system. If you do this as root everything is pretty easy to restore. Using the guide below (its based on Ubuntu but works fine for either it or debian--or probably a host of other distros) I've been taking weekly backup snapshots (automated with cron) of my servers system (everything except the movies / music / documents.) Twice now when I've screwed up something really bad all I've had to do is run a single command (as root) and while still booted into the messed up system (or from a live system like #!), reboot, and my everything was back in place like the day the snapshot was made.

The downside of this is you'll probably have to clean out old snapshots as they grow stale and you don't have any need for them. The other option is to simply copy over your previous backup each time you make a new tar archive. (So instead of have lots of dated backups around, you just have one.) I do the later on the laptop i carry around so that I always have a backup handy without sacrificing too much disk space.

The amount of disk space this will require depends on what you exclude. Personally I include /home simply because none of my major media is stored there--but configs and virtual machines I want in a backup are. As such my tar backups can be up to 6 or 7 gigs.

The guide I used as a base is at: http://ubuntuforums.org/showthread.php?t=35087

The script I use to make dated backups on my server looks like:

#!/bin/bash
DATE="`date +%F`"
mount /media/redundant
cd /media/redundant/server
tar cvpzf backup_$DATE.tgz --exclude=/proc --exclude=/lost+found --exclude=/media --exclude=/mnt --exclude=/sys --exclude=/mnt /
umount /media/redundant

Line by line this does:
1)Set variable for todays date
2)Mount media where I"m going to store the backup
3)Change directory to where the backup will be made
4)Creating the backup archive with the name backup_$DATE (so it puts the current date in the name.) The rest of the command is a lot of excluded directories, and the final command "/" indicates I want to backup up everything on the drive.
5)Unmount media now that I'm done using it.

The cron setup for a once-weekly backup:

0 1 * * 7 /root/bin/serverbackup.sh

.

Personally I've found tar preferable to rsync for system backups, and rsync preferable to tar for media (music,movies,documents) backups. 

Hope this helps.

IRC: PizzaAndWine     Script bits: Incremental Backup | Sleep Timer

Re: [Solved] Backing up with grsync

Wow, that looks cool. I'll look into it once I've got some more time! big_smile

Let's do it and don't screw it.
      Github || Deviantart

Re: [Solved] Backing up with grsync

A few additional things to add to my post above....

1) The script isn't cron-specific. You can simply run it from a terminal.
2) Of course, you'll need edit the directory paths and the paths of excluded directories.
3) If cron isn't your thing, you might check out anacron. Whereas cron works at specific times, anacron works based on intervals (daily, weekly, monthly). This can be handy if you need access to external disks that aren't always around.
4) Using anacron in conjunction with a  "Continue? yes/no" option at the beginning of the script is a handy way to only run the script if you have the necessary external drive handy. The code at the beginning would look something like this...

read -p "Continue to make a tar backup -- requires external drive? (y/n)" tocontinue
if [ "$tocontinue" = "n" ] || [ "$tocontinue" = "N" ]; then 
    echo "Will exit backup script."
    sleep 2s
    exit 0
fi

Hope this helps.

IRC: PizzaAndWine     Script bits: Incremental Backup | Sleep Timer