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
Making a Test Backup

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

Using the backup device naming examples from last week's article, let's make a test backup to a USB drive of any kind. Plug it in, and then copy a couple of directories to it using this command. Remember, in part 1 we formatted the backup drive in FAT16/32, so the rsync options are special to the FAT filesystems. In this example I backup my finances and configs directories, using the full absolute path names:

$ rsync -rlvt --modify-window=1 ~/finances ~/configs /media/BACKUP1

The tilde, ~, is a shortcut for home directory. You'll see filenames whiz by, and then a summary:

sent 8306732 bytes  received 1270 bytes  3323200.80 bytes/sec
total size is 8301576 speedup is 1.00

Now open /media/BACKUP1 and admire your backed-up files. They look like normal files, which they are, which you can view and copy like any normal Linux files.

Mind your trailing slashes! Notice there aren't any, so I'll end up with /media/BACKUP1/finances and /media/BACKUP1/configs. If I named finances/ and configs/ instead, then I would get /media/BACKUP1 without the two directories, but only the files that were in them.

Now try a cool thing: hit the Up arrow to display your rsync command again and hit enter to re-run it. You'll see something like this:

$ rsync -rlvt --modify-window=1 ~/finances ~/configs /media/BACKUP1
sent 1582 bytes  received 20 bytes  3204.00 bytes/sec
total size is 8301576  speedup is 5182.0

Notice the difference in the "sent" values. This shows that your rsync incantation worked correctly and transferred only changes on the second run.

The -r switch means recursive; -v is verbose, -l copies symlinks, -t preserves the modified times, and --modify-window=1 allows for a 1-second difference in the modified times between the original and copied files. The last three options are necessary hacks for FAT16/32. If you leave out the -t switch rsync will re-copy your files instead of transferring only changes. FAT16/32 represents times with up to two seconds' resolution, so you need the --modify-window option to allow for this.

rsync has a --dry-run option which you should always use when you're not sure if you have it right. This shows you what will happen without actually doing anything.

Next: Refining Your Rsync Incantation »

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