How To Use rsync Command To Backup Directory Under Linux

by Vivek Gite on March 2, 2008 · 5 comments

Q. How do I use rsync command to back up a home directory under Linux operating system?

A. rsync command easily backup your home directory to local secondary hard disk or remote server using ssh protocol. rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate.

Task: Backup /home/tom to /mnt/usbpen

Assuming that USB pen or external USB hard disk is mounted at /mnt/usbpen, enter the following command to backup (sync) new files and changes to existing files but don't remove files in backup directory:
$ rsync -au /home/tom /mnt/usbpen
To delete files in backup directory that no longer exist in directory being backed up, enter:
$ rsync -au --delete /home/tom /mnt/usbpen

See our previous article about using rsync for transferring files under Linux or UNIX from local or remote network computer.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 5 comments… read them below or add one }

1 Peterson Spaceport November 27, 2009

Thanks, simple and effective article! Going to test the commands =)

Reply

2 mitch February 12, 2010

Thank you, very helpful
M

Reply

3 pcman August 23, 2010

Yeah it is easy as can be…Thanks.

Reply

4 Leontianos December 16, 2010

Thank you :) very usefull

Reply

5 Erik February 17, 2011

Thanks.
I also do rsync -aurl –delete /source /destination
to backup.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">




Previous post:

Next post: