How To Backup Linux - 15 Rsync Command Examples
How To Backup Linux - 15 Rsync Command Examples
15 rsync Command Examples
≡ Menu
Home
Free eBook
Start Here
Contact
About
How to Backup Linux? 15 rsync Command
Examples
by Sasikala on September 9, 2010
110 Like 144 Tweet
rsync stands for remote sync.
rsync is used to perform the backup operation in UNIX / Linux.
rsync utility is used to synchronize the files and directories from one location to another in an effective way.
Backup location could be on local server or on remote server.
Important features of rsync
Speed: First time, rsync replicates the whole content between the source and destination directories.
Next time, rsync transfers only the changed blocks or bytes to the destination location, which makes
the transfer really fast.
Security: rsync allows encryption of data using ssh protocol during transfer.
Less Bandwidth: rsync uses compression and decompression of data block by block at the sending
and receiving end respectively. So the bandwidth used by rsync will be always less compared to other
file transfer protocols.
Privileges: No special privileges are required to install and execute rsync
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 1/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Syntax
$ rsync options source destination
Source and destination could be either local or remote. In case of remote, specify the login name, remote
server name and location.
Example 1. Synchronize Two Directories in a Local Server
To sync two directories in a local computer, use the following rsync zvr command.
$ rsync ‐zvr /var/opt/installation/inventory/ /root/temp
building file list ... done
sva.xml
svB.xml
.
sent 26385 bytes received 1098 bytes 54966.00 bytes/sec
total size is 44867 speedup is 1.63
$
In the above rsync example:
z is to enable compression
v verbose
r indicates recursive
Now let us see the timestamp on one of the files that was copied from source to destination. As you see
below, rsync didn’t preserve timestamps during sync.
$ ls ‐l /var/opt/installation/inventory/sva.xml /root/temp/sva.xml
‐r‐‐r‐‐r‐‐ 1 bin bin 949 Jun 18 2009 /var/opt/installation/inventory/sva.xml
‐r‐‐r‐‐r‐‐ 1 root bin 949 Sep 2 2009 /root/temp/sva.xml
Example 2. Preserve timestamps during Sync using rsync a
rsync option a indicates archive mode. a option does the following,
Recursive mode
Preserves symbolic links
Preserves permissions
Preserves timestamp
Preserves owner and group
Now, executing the same command provided in example 1 (But with the rsync option a) as shown below:
$ rsync ‐azv /var/opt/installation/inventory/ /root/temp/
building file list ... done
./
sva.xml
svB.xml
.
sent 26499 bytes received 1104 bytes 55206.00 bytes/sec
total size is 44867 speedup is 1.63
$
As you see below, rsync preserved timestamps during sync.
$ ls ‐l /var/opt/installation/inventory/sva.xml /root/temp/sva.xml
‐r‐‐r‐‐r‐‐ 1 root bin 949 Jun 18 2009 /var/opt/installation/inventory/sva.xml
‐r‐‐r‐‐r‐‐ 1 root bin 949 Jun 18 2009 /root/temp/sva.xml
Example 3. Synchronize Only One File
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 2/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
To copy only one file, specify the file name to rsync command, as shown below.
$ rsync ‐v /var/lib/rpm/Pubkeys /root/temp/
Pubkeys
sent 42 bytes received 12380 bytes 3549.14 bytes/sec
total size is 12288 speedup is 0.99
Example 4. Synchronize Files From Local to Remote
rsync allows you to synchronize files/directories between the local and remote system.
$ rsync ‐avz /root/temp/ thegeekstuff@192.168.200.10:/home/thegeekstuff/temp/
Password:
building file list ... done
./
rpm/
rpm/Basenames
rpm/Conflictname
sent 15810261 bytes received 412 bytes 2432411.23 bytes/sec
total size is 45305958 speedup is 2.87
While doing synchronization with the remote server, you need to specify username and ipaddress of the
remote server. You should also specify the destination directory on the remote server. The format is
username@machinename:path
As you see above, it asks for password while doing rsync from local to remote server.
Sometimes you don’t want to enter the password while backing up files from local to remote server. For
example, If you have a backup shell script, that copies files from local to remote server using rsync, you need
the ability to rsync without having to enter the password.
To do that, setup ssh password less login as we explained earlier.
Example 5. Synchronize Files From Remote to Local
When you want to synchronize files from remote to local, specify remote path in source and local path in
target as shown below.
$ rsync ‐avz thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list ... done
rpm/
rpm/Basenames
.
sent 406 bytes received 15810230 bytes 2432405.54 bytes/sec
total size is 45305958 speedup is 2.87
Example 6. Remote shell for Synchronization
rsync allows you to specify the remote shell which you want to use. You can use rsync ssh to enable the
secured remote connection.
Use rsync e ssh to specify which remote shell to use. In this case, rsync will use ssh.
$ rsync ‐avz ‐e ssh thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list ... done
rpm/
rpm/Basenames
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 3/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
sent 406 bytes received 15810230 bytes 2432405.54 bytes/sec
total size is 45305958 speedup is 2.87
Example 7. Do Not Overwrite the Modified Files at the Destination
In a typical sync situation, if a file is modified at the destination, we might not want to overwrite the file with
the old file from the source.
Use rsync u option to do exactly that. (i.e do not overwrite a file at the destination, if it is modified). In the
following example, the file called Basenames is already modified at the destination. So, it will not be
overwritten with rsync u.
$ ls ‐l /root/temp/Basenames
total 39088
‐rwxr‐xr‐x 1 root root 4096 Sep 2 11:35 Basenames
$ rsync ‐avzu thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list ... done
rpm/
sent 122 bytes received 505 bytes 114.00 bytes/sec
total size is 45305958 speedup is 72258.31
$ ls ‐lrt
total 39088
‐rwxr‐xr‐x 1 root root 4096 Sep 2 11:35 Basenames
Example 8. Synchronize only the Directory Tree Structure (not the files)
Use rsync d option to synchronize only directory tree from source to the destination. The below example,
synchronize only directory tree in recursive manner, not the files in the directories.
$ rsync ‐v ‐d thegeekstuff@192.168.200.10:/var/lib/ .
Password:
receiving file list ... done
logrotate.status
CAM/
YaST2/
acpi/
sent 240 bytes received 1830 bytes 318.46 bytes/sec
total size is 956 speedup is 0.46
Example 9. View the rsync Progress during Transfer
When you use rsync for backup, you might want to know the progress of the backup. i.e how many files are
copies, at what rate it is copying the file, etc.
rsync –progress option displays detailed progress of rsync execution as shown below.
$ rsync ‐avz ‐‐progress thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list ...
19 files to consider
./
Basenames
5357568 100% 14.98MB/s 0:00:00 (xfer#1, to‐check=17/19)
Conflictname
12288 100% 35.09kB/s 0:00:00 (xfer#2, to‐check=16/19)
.
.
.
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 4/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
sent 406 bytes received 15810211 bytes 2108082.27 bytes/sec
total size is 45305958 speedup is 2.87
You can also use rsnapshot utility (that uses rsync) to backup local linux server, or backup remote linux
server.
Example 10. Delete the Files Created at the Target
If a file is not present at the source, but present at the target, you might want to delete the file at the target
during rsync.
In that case, use –delete option as shown below. rsync delete option deletes files that are not there in source
directory.
# Source and target are in sync. Now creating new file at the target.
$ > new‐file.txt
$ rsync ‐avz ‐‐delete thegeekstuff@192.168.200.10:/var/lib/rpm/ .
Password:
receiving file list ... done
deleting new‐file.txt
./
sent 26 bytes received 390 bytes 48.94 bytes/sec
total size is 45305958 speedup is 108908.55
Target has the new file called newfile.txt, when synchronize with the source with –delete option, it removed
the file newfile.txt
Example 11. Do not Create New File at the Target
If you like, you can update (Sync) only the existing files at the target. In case source has new files, which is
not there at the target, you can avoid creating these new files at the target. If you want this feature, use –
existing option with rsync command.
First, add a newfile.txt at the source.
[/var/lib/rpm ]$ > new‐file.txt
Next, execute the rsync from the target.
$ rsync ‐avz ‐‐existing root@192.168.1.2:/var/lib/rpm/ .
root@192.168.1.2's password:
receiving file list ... done
./
sent 26 bytes received 419 bytes 46.84 bytes/sec
total size is 88551424 speedup is 198991.96
If you see the above output, it didn’t receive the new file newfile.txt
Example 12. View the Changes Between Source and Destination
This option is useful to view the difference in the files or directories between source and destination.
At the source:
$ ls ‐l /var/lib/rpm
‐rw‐r‐‐r‐‐ 1 root root 5357568 2010‐06‐24 08:57 Basenames
‐rw‐r‐‐r‐‐ 1 root root 12288 2008‐05‐28 22:03 Conflictname
‐rw‐r‐‐r‐‐ 1 root root 1179648 2010‐06‐24 08:57 Dirnames
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 5/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
At the destination:
$ ls ‐l /root/temp
‐rw‐r‐‐r‐‐ 1 root root 12288 May 28 2008 Conflictname
‐rw‐r‐‐r‐‐ 1 bin bin 1179648 Jun 24 05:27 Dirnames
‐rw‐r‐‐r‐‐ 1 root root 0 Sep 3 06:39 Basenames
In the above example, between the source and destination, there are two differences. First, owner and group
of the file Dirname differs. Next, size differs for the file Basenames.
Now let us see how rsync displays this difference. i option displays the item changes.
$ rsync ‐avzi thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list ... done
>f.st.... Basenames
.f....og. Dirnames
sent 48 bytes received 2182544 bytes 291012.27 bytes/sec
total size is 45305958 speedup is 20.76
In the output it displays some 9 letters in front of the file name or directory name indicating the changes.
In our example, the letters in front of the Basenames (and Dirnames) says the following:
> specifies that a file is being transferred to the local host.
f represents that it is a file.
s represents size changes are there.
t represents timestamp changes are there.
o owner changed
g group changed.
Example 13. Include and Exclude Pattern during File Transfer
rsync allows you to give the pattern you want to include and exclude files or directories while doing
synchronization.
$ rsync ‐avz ‐‐include 'P*' ‐‐exclude '*' thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list ... done
./
Packages
Providename
Provideversion
Pubkeys
sent 129 bytes received 10286798 bytes 2285983.78 bytes/sec
total size is 32768000 speedup is 3.19
In the above example, it includes only the files or directories starting with ‘P’ (using rsync include) and
excludes all other files. (using rsync exclude ‘*’ )
Example 14. Do Not Transfer Large Files
You can tell rsync not to transfer files that are greater than a specific size using rsync –maxsize option.
$ rsync ‐avz ‐‐max‐size='100K' thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list ... done
./
Conflictname
Group
Installtid
Name
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 6/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Sha1header
Sigmd5
Triggername
sent 252 bytes received 123081 bytes 18974.31 bytes/sec
total size is 45305958 speedup is 367.35
maxsize=100K makes rsync to transfer only the files that are less than or equal to 100K. You can indicate M
for megabytes and G for gigabytes.
Example 15. Transfer the Whole File
One of the main feature of rsync is that it transfers only the changed block to the destination, instead of
sending the whole file.
If network bandwidth is not an issue for you (but CPU is), you can transfer the whole file, using rsync W
option. This will speedup the rsync process, as it doesn’t have to perform the checksum at the source and
destination.
# rsync ‐avzW thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp
Password:
receiving file list ... done
./
Basenames
Conflictname
Dirnames
Filemd5s
Group
Installtid
Name
sent 406 bytes received 15810211 bytes 2874657.64 bytes/sec
total size is 45305958 speedup is 2.87
Additional rsync Tutorials
How to Setup Rsync with SSH on UNIX / Linux (rsync without password)
6 rsync Examples to Exclude Multiple Files and Directories using excludefrom
This is for 2 full days of handson training workshop on Linux system administration.
If you've been thinking about getting a strong foundation on Linux Sysadmin, use this opportunity, and don't
delay it any further.
Learn more about the workshop and register from here.
If you enjoyed this article, you might also like..
1. 50 Linux Sysadmin Tutorials Awk Introduction – 7 Awk Print Examples
2. 50 Most Frequently Used Linux Commands (With Advanced Sed Substitution Examples
Examples) 8 Essential Vim Editor Navigation
3. Top 25 Best Linux Performance Monitoring and Fundamentals
Debugging Tools 25 Most Frequently Used Linux IPTables
4. Mommy, I found it! – 15 Practical Linux Find Rules Examples
Command Examples Turbocharge PuTTY with 12 Powerful
5. Linux 101 Hacks 2nd Edition eBook AddOns
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 7/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
{ 68 comments… add one }
diptanu paul September 9, 2010, 3:48 am
Of the track I recently found one good option for backup (fresh install) of a system which contains lot
of customised packages, we can use the “Ghost for linux”. This can be used to take a cold backup of
entire system (including the customised packages + OS), which can used to redeploy the same setup in
a diffrent server or be used in the same server incase of crash of the system.
This saves the pain of reinstalling the OS and the packages from the begining.
Link
Gopinath September 9, 2010, 11:38 am
Hi ,
Thanks Its very use full for me
Link
mike September 9, 2010, 3:47 pm
hi folks.
here are two items i always mention when teaching people about ‘rsync’.
i always test it first with a dry run (simulation). append –dryrun or n to your options to see what files
*would* be copied or deleted without actually doing the action.
also, including a trailing slash vs omitting it produces different results.
without the trailing slash…
rsync avz 192.168.200.10:/tmp/dir .
would produce
dir/file01
dir/file02
whereas including the trailing slash…
rsync avz 192.168.200.10:/tmp/dir/ .
would produce
file01
file02
keep up the great job on The Geek Stuff! thanks. mike
Link
LinuxGeek September 10, 2010, 2:50 am
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 8/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
What’s the point of compressing data that is only copied from one directory to another on the same
computer? (example 1)
Link
Oso September 10, 2010, 12:33 pm
EXCELLENT!!!
Mike comment too .)
Link
SG September 13, 2010, 8:59 am
Great tutorial Ramesh – thanks again for taking the time to put this together!
Link
vasiauvi October 16, 2010, 1:53 am
Hello,
nice tips!
How can I do an incremental backup? I have a folder and want to backup only the modified files…
Thank you!
Link
Rajesh November 11, 2010, 9:21 am
How to delete file at source after it is copied to destination
Link
zeek December 25, 2010, 2:50 pm
Sasikala –> Thanks, very helpful, off to try them out
Mike –> Thanks for your example in your comment (and the dry run option).
Happy Holidays.
Link
ali January 20, 2011, 3:29 pm
hi
my english isnt very well
when we remot to a server by ssh the first directory is the home directory of that user so when we write
command like this
rsync avz e ssh alieblice@192.168.16.12:var/www home/backup
it says that thers isnt any var/www directory
my question is : how can i backup a folder out of the home directory ?
Link
Cissy January 25, 2011, 6:43 am
Well, thanks..
I have learned a lot.. They are useful.. lol
Link
Carson January 28, 2011, 1:04 am
Hi Ali,
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 9/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Specify this, if you want to do something outside the relative path: rsync avz e ssh
alieblice@192.168.16.12:/var/www /home/backup
Using absolute paths is a nice way to be 100% sure of what you are copying.
Regards,
Carson.
Link
kaling February 3, 2011, 5:52 am
hi all,
it backup with automatic in one server to another server without password How to anyone help!!!
advance thanks
with regards
Kaling…
Link
sherwin March 16, 2011, 7:42 pm
thank you very much! i have been trying to use rsync to oneway sync an itunes library from one mac
to another machine. is there a way to get more details in to a log file? like date/timestamp? i’ve added
>> /path/to/log.txt and it works well. just need to add date/timestamp. also would it be possible to get
an email when rsync is done?
Link
Gabriel SOE March 20, 2011, 2:54 am
Thanks for a great tutorial. in depth and clear.
Link
rakitha beminiwatttha March 29, 2011, 12:34 pm
This is a good summary of rsync stuff that is important.
This was helpful for me!
keep posting stuff like these.
Link
p.a.blok April 20, 2011, 2:16 am
When using the d option to copy Only the Directory Tree, not only the dirtree gets copied. FILES in
the top source dir also get copied!!
Link
p.a.blok April 20, 2011, 2:35 am
You had better control this with:
rsync v d –maxsize=’10K’ ~/Music/ .
Link
Pier July 12, 2011, 2:31 pm
@diptanu paul
I know it is late!! but this is just to point out that in order to get homogenics workstations we do use at
my company the mechanised installation through the Kickstart + PXE boot process. In my opinion it is
a lot better than deploying HDD clones, as the KS process is not dependent to the hardware…
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 10/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
just my opinion and my experiences.
Link
sunoop July 18, 2011, 8:04 am
nice tutrl………………..thnks alot
Link
TK Nallappan August 6, 2011, 5:11 pm
Hi Ramesh,
Thanks for your awesome rsync article. I would like to include the 16 rsync example command here
below.
Rsync with custom SSH port no :
==========================
# rsync avz e “ssh p 2323” nagiosplugins1.4.1.tar.gz root@xx.xx.xx.xx:/root
root@xx.xx.xx.xx‘s password:
nagiosplugins1.4.1.tar.gz
sent 967995 bytes received 42 bytes 45024.98 bytes/sec
total size is 967552 speedup is 1.00
==========================
Link
kamal September 5, 2011, 7:16 am
Realy it’s help me a lots . Thanks buddy.
Link
Robbie October 11, 2011, 5:13 pm
When running rsync between 2 local directories, you dont want to use z (compress), it’ll just load up
your processor and slow down the transfer.
Link
debianuser October 20, 2011, 2:13 pm
Thank’s for this very usefull article. Thank’s to you too TK Nallappan, for the ssh tips
Link
dixhuit October 25, 2011, 5:18 am
Very, very useful. I learnt so much, so quickly thanks to this post. Many thanks.
Link
thomas November 8, 2011, 3:14 am
Is it possible to tell rsync to copy only files belonging to a certain user ?
I have the problem that when I tell rsync to copy links I don’t want to end up
with a lot of files from other people (if the links point there).
Link
Anonymous November 11, 2011, 3:36 am
Your tutorials are easy to understand for me. Please Keep writing
Link
G November 28, 2011, 10:19 am
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 11/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Very good article, and usefull topics.
U ROCK
Link
jmazaredo December 21, 2011, 7:18 pm
Very well written and easy to understand. A+
Link
Gausstein February 7, 2012, 10:16 am
Thanks!!!!
Link
srdlr February 21, 2012, 1:37 am
ssh: connect to host 192.168.3.6 port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.8]
what is the problem with this?
THANK YOU!
Link
Alieblice February 21, 2012, 12:20 pm
Use ” v ” to get more data
ynu can use up to 3 “v”
Link
aditya March 13, 2012, 6:38 am
really awesome. even offical site for rsync is not so clear. explained with examples really rocks.
Thanks.
Link
skn March 18, 2012, 9:12 pm
I want to transfer my output data files(vtk/png files) only from remote to local computer. What can I
do in this regard?
Link
gkontos April 20, 2012, 9:01 am
Excellent tutorial!
Link
siraj May 1, 2012, 1:42 am
# rsync avz administrator@10.120.1.1:/win7/a /home/siraj/
connection ssh port 22 refused
(i am getting an error when trying to copy from windows to linux
please help)
Link
Joseph May 1, 2012, 4:07 pm
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 12/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Great article, and well explained.
I’d like to find some further information on the: “only sending the changed blocks”. I find this
amazing in situations where there is a large file– such as a VM file.
Link
Charlie May 6, 2012, 12:33 am
Nice article, for bonus points: is there any way to capture all changed files and put them somewhere on
each run? I’m using –backupdir but that only retains one version of each file. Maybe the trick is to
gzip that tree and erase it after each run, but I also want to set up so that only the original rsync
command can be executed ( have to push from a shared host, want to secure the backup server better ).
Basically looking for a versioncontrollike setup that captures most versions of files in development at
least at the intervals I set.
Siraj, you can debug your connection using an interactive ssh. Best thing to do is to use certificates if
you want an unattended backup, this isn’t covered in this article but search rsync sshkeygen to find
several good articles on doing those.
Link
Amol Pujari May 17, 2012, 11:11 pm
Can achieve the following …
updating of a single file locally, should update the remote copy instantly
Link
somenath May 30, 2012, 2:38 pm
very useful!!!!!!!!!!!!
Link
Ram June 6, 2012, 3:27 am
Hi, i am using rsync to backup from remote to local but in backup it not recognise the extension of file
such as font that not have extension like .ttf etc. in backup copy not reconised as font but it seems a
document and i cant use that font from backup. Is something special for risolve this in rsync? Thanks
to all if someone can help me.
Link
zero June 13, 2012, 11:08 am
I have errors at server and can not update.
Repeat calls to rysnc to syncronize, but it deletes file on the destination folder. So an error can delete
many gigs of already copied data the next time rsync is called.
Link
Chandan Kumar August 1, 2012, 1:29 am
Hi ,
its really very useful , please keep it up .. it help us a lot
Regards
Chandan Kumar
Link
Gaurav September 26, 2012, 5:29 am
Ramesh ,
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 13/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Can you help me for one rsync scenario . if i removed some source files then how we can refelect this
changes on destination using rsync. any help from you and others will be appriciated . Thanks in
advance.
Link
Joseph September 26, 2012, 8:41 am
Guarav:
If you use the –delete option, it will delete the files on the target, causing a truly synchronized system.
IE:
rsync av –delete /path/to/source /path/to/destination
Link
Gaurav October 9, 2012, 2:32 am
Thanks,
Joseph for your help !!!
Link
John December 29, 2012, 1:06 am
Awesome info and example. I do one question about the W option. I am rsync on a LAN network
work as oppose to the over the wan, should I use the W option? I don’t see much of W option any of
the other documentations and examples. Just curious. Looking to foward to hear from you.
Link
Don Fink March 5, 2013, 5:42 am
This is extremely useful. It provides all the information I have been researching for the past several
days about syncing from my remote server back to my local machine.
Thanks,
Link
chetan March 15, 2013, 9:32 am
Can u have any steps to take full backup of OS and restore it on another server using live CD.
Link
nareshtallet April 3, 2013, 12:06 am
excellent geekss……good stufff..
Link
feld May 23, 2013, 10:43 am
Great guide. Useful e simple to read ! thanks a lot.
Link
Francois Scheurer August 12, 2013, 8:37 am
rsync can use hard links for create incremental backups, but even so some kind of backup rotation is
needed to limit the required disk space. Check here.
10 backups gives usually 10 days or retention.
I writed a rsync shellscript with a nonlinear rotation to extend this retention.
10 backups is then enough to retain 1 year of the backups, e.g. with daily snapshots 1, 2, 3, 4, 6, 10,
18, 50, 114, 242.
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 14/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Link
naveen September 2, 2013, 1:15 am
good
Link
Frank Kim September 2, 2013, 8:21 pm
Nice article! Very helpful.
Link
Mohan September 3, 2013, 7:21 am
Thank you Mr.Ramesh.
Link
Mark September 18, 2013, 1:04 pm
I’ve been using RSYNC (actually GRSYNC) to backup my entire Home directory to an external
harddrive for years. Then when it comes time to upgrade to the next release, I tend to install new
(instead of allow system to update to the next release) and have used my saved files on my external
harddrive to recover my data. It has worked great. The first copy will take awhile, dependent upon the
number and size of your files, but after that it will look for what has changed and only copy of those
files. Very quick.
Link
Disco Babu November 13, 2013, 4:55 am
Very nicely done
Link
Oliver Nicholson March 8, 2014, 6:33 pm
Hi there,
Thanks for the great info! Just wanted to mention though, and correct me if I’m wrong, but I think
you’ve got the ls l examples of backup preserving or notpreserving timestamps the wrong way round.
Cheers again,
Ollie.
************************
Link
safeer May 9, 2014, 10:22 am
Very nicely documented..
Thanks Ramesh for this…
Link
Chang May 29, 2014, 1:01 am
Very nice description. Thanks a bunch buddy!
Link
Anonymous June 12, 2014, 6:20 am
how to transfer only one particular file when we want it to be transferred to remote system. Can’t use
scp/sftp
Link
Laith Al Obaidy September 3, 2014, 12:10 pm
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 15/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
I still can’t see that big difference between rsync and scp!
Link
George F. Rice November 8, 2014, 7:33 am
Very clearly written, thanks much!
Link
Mehul Bhandari November 29, 2014, 5:38 am
How to copy live data like sql
and block level in rsync ??? can u give me way to do this ???
Link
kashu February 23, 2015, 7:47 am
Great!
Link
BrainBug March 11, 2015, 4:36 am
i use ssl whith publickey.
how do i use rssync ?
Link
Dwayne D December 15, 2015, 4:20 am
I refer to your website whenever I want to use rsync.
Clear. Concise. Incredibly usable.
Thank you.
Link
Alex February 1, 2016, 11:48 am
Wow, I am amazed at the power of this tool/command.
Thanks.
Link
Leave a Comment
Name
Website
Comment
Submit
Notify me of followup comments via email
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 16/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Next post: 6 Perl File Handle Examples to Open, Read, and Write File
Previous post: Linux Directory Structure (File System Structure) Explained with Examples
RSS | Email | Twitter | Facebook | Google+
Search
EBOOKS
Linux 101 Hacks 2nd Edition eBook Practical Examples to Build a Strong Foundation in
Linux
Bash 101 Hacks eBook Take Control of Your Bash Command Line and Shell Scripting
Sed and Awk 101 Hacks eBook Enhance Your UNIX / Linux Life with Sed and Awk
Vim 101 Hacks eBook Practical Examples for Becoming Fast and Productive in Vim Editor
Nagios Core 3 eBook Monitor Everything, Be Proactive, and Sleep Well
The Geek Stuff
16,261 likes
Like Page Share
3 friends like this
POPULAR POSTS
12 Amazing and Essential Linux Books To Enrich Your Brain and Library
50 UNIX / Linux Sysadmin Tutorials
50 Most Frequently Used UNIX / Linux Commands (With Examples)
How To Be Productive and Get Things Done Using GTD
30 Things To Do When you are Bored and have a Computer
Linux Directory Structure (File System Structure) Explained with Examples
Linux Crontab: 15 Awesome Cron Job Examples
Get a Grip on the Grep! – 15 Practical Grep Command Examples
Unix LS Command: 15 Practical Examples
15 Examples To Master Linux Command Line History
Top 10 Open Source Bug Tracking System
Vi and Vim Macro Tutorial: How To Record and Play
Mommy, I found it! 15 Practical Linux Find Command Examples
15 Awesome Gmail Tips and Tricks
15 Awesome Google Search Tips and Tricks
RAID 0, RAID 1, RAID 5, RAID 10 Explained with Diagrams
Can You Top This? 15 Practical Linux Top Command Examples
Top 5 Best System Monitoring Tools
Top 5 Best Linux OS Distributions
How To Monitor Remote Linux Host using Nagios 3.0
Awk Introduction Tutorial – 7 Awk Print Examples
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 17/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
How to Backup Linux? 15 rsync Command Examples
The Ultimate Wget Download Guide With 15 Awesome Examples
Top 5 Best Linux Text Editors
Packet Analyzer: 15 TCPDUMP Command Examples
The Ultimate Bash Array Tutorial with 15 Examples
3 Steps to Perform SSH Login Without Password Using sshkeygen & sshcopyid
Unix Sed Tutorial: Advanced Sed Substitution Examples
UNIX / Linux: 10 Netstat Command Examples
The Ultimate Guide for Creating Strong Passwords
6 Steps to Secure Your Home Wireless Network
Turbocharge PuTTY with 12 Powerful AddOns
CATEGORIES
Linux Tutorials
Vim Editor
Sed Scripting
Awk Scripting
Bash Shell Scripting
Nagios Monitoring
OpenSSH
IPTables Firewall
Apache Web Server
MySQL Database
Perl Programming
Google Tutorials
Ubuntu Tutorials
PostgreSQL DB
Hello World Examples
C Programming
C++ Programming
DELL Server Tutorials
Oracle Database
VMware Tutorials
Ramesh Natarajan
Follow
About The Geek Stuff
My name is Ramesh Natarajan. I will be posting instruction guides, howto, troubleshooting
tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either
teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.
Contact Us
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 18/19
1/28/2017 How to Backup Linux? 15 rsync Command Examples
Email Me : Use this Contact Form to get in touch me with your comments, questions or suggestions about
this site. You can also simply drop me a line to say hello!.
Follow us on Google+
Follow us on Twitter
Become a fan on Facebook
Support Us
Support this blog by purchasing one of my ebooks.
Bash 101 Hacks eBook
Sed and Awk 101 Hacks eBook
Vim 101 Hacks eBook
Nagios Core 3 eBook
Copyright © 2008–2017 Ramesh Natarajan. All rights reserved | Terms of Service
http://www.thegeekstuff.com/2010/09/rsynccommandexamples 19/19