Questions with rsync
Rick Stevens
ricks at nerd.com
Wed Jun 3 18:00:44 UTC 2009
GMS S wrote:
> [
> I would pretty much recommend that you specifically omit /dev and /proc
> too.
>
> Save the filter to a text file and make it look something like this (I
> like the first one but you might not). + and - symbols should be
> obvious.
>
> - ~*
> - /lost+found/
> + **/home/user/backup
>
> rsync -vpa --filter='. /path/to/rsync-filter' $source $destination
>
> I didn't think '-a' option indicates compression at all, only 'archive'
> and you might want '-u' option for update.
>
> Craig
> ]
>
> So what would be the final command if I exclude these directory?
>
> /lost+found
> /media
> /mnt
> /dev
> /proc
> /home/user/backup
> /dev
I use this sort of thing with a 500GB USB drive (automounted at
"/media/500GB-Drive" by Gnome):
#!/bin/bash
# Back up system to a specific directory given on the command
# line or a default based on today's date. Excludes the /proc,
# /sys, /dev and /media directories
MYHOST=`hostname`
TODAY=`date +%d-%b-%Y`
if [ $# -lt 1 ]; then
TGT="/media/500GB-Drive/$MYHOST-BackUp-$TODAY"
else
TGT=$1
fi
rsync -avXA --exclude-from=/etc/skipdirs.rsync / $TGT
with /etc/skipdirs.rsync containing:
/proc/*
/sys/*
/dev/*
/media/*
Tweak as you see fit.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer ricks at nerd.com -
- AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 -
- -
- To err is human, to moo bovine. -
----------------------------------------------------------------------
More information about the fedora-list
mailing list