Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Java/Open Source Daily
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials







Linux Backups For Real People, Part 2
Refining Your Rsync Incantation

Carla Schroder
Thursday, November 8, 2007 10:18:54 AM

rsync has a lot of options, which you'll see in man rsync. Here are some of the more useful options:

-- delete
When you delete files from your system, using this option will also delete them from your backup drive.

--exclude-from=[filename]
You can create a file that specifies filetypes that you don't want backed up, putting one item per line like this:

*.tmp
*.temp
*.bak

--include-from=[filename]
You may use this option to list directories to include, but it must be done in the exactly correct way, or it won't work, and then you'll join the legions of sad, lost people roaming Google trying to find answers. I'm backing up /home/carla/finances and /home/carla/configs, so I make these entries in my rsync-includes file; the double asterisks ensure that all sub-directories will also be copied:

+ /finances
+ /finances/**
+ /configs
+ /configs/**
- *
Then I name the parent directory in the rsync command this way: /home/carla/*. Let's put it all together:
$ rsync -rlvt --modify-window=1 --delete 
--include-from=/home/carla/rsync-includes /home/carla/* /media/BACKUP1

Throw in another -v or two for debugging if you run into trouble. There are more ways to use --include-from and --exclude-from, but that's as far as we're going today.

That's all a bit much to type a lot, so one good shortcut is to create a Bash alias:

$ alias backup1='rsync -rlvt --modify-window=1 --delete
--include-from=/home/carla/rsync-includes /home/carla/* /media/BACKUP1'

So now all you do is type backup1 to run your backup. You can run it as often as you like; for example, if you're working on an important document there's no reason you can't run your backup command as often as your "save" command.

Come back next week for Part 3 to learn how to do easy network backups, how to automate your backups, and how to create nice desktop icons for one-click backups.

Resources

  • man 1 rsync
  • man 1 df
  • man 1 du
  • man 1 bash to learn about alias

« Back: Single-User Backups

Skip Ahead

1 Single-User Backups
2 Making a Test Backup
3 Refining Your Rsync Incantation





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers