50 lines
1.5 KiB
HTML
50 lines
1.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<link rel="Stylesheet" type="text/css" href="style.css">
|
|
<title>Server_Admin_Rsync</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
</head>
|
|
<body>
|
|
|
|
<h4 id="toc_0.0.0.1">RSync</h4>
|
|
<p>
|
|
Basic Rsync Backup
|
|
<code>rsync -av source/ destination/</code>
|
|
To/From Remote
|
|
<code>rsync -av -e ssh source/ username@remotemachine:/path/to/destination/</code>
|
|
</p>
|
|
|
|
<h5 id="toc_0.0.0.1.1">Trailing Slashes <em>Do</em> matter... Sometimes</h5>
|
|
<p>
|
|
Rsync cares about trailing slashes on the <strong>source</strong> argument.
|
|
For example, let <code>a</code> and <code>b</code> be two directories with the file <code>foo</code> initially in <code>a</code>:
|
|
<code>rsync -a a b</code>
|
|
produces <code>b/a/foo</code> whereas
|
|
<code>rsync -a a/ b</code>
|
|
produces <code>b/foo</code>. A trailing slash on the destination has no effect.
|
|
</p>
|
|
|
|
<h5 id="toc_0.0.0.1.2">Incremental Backups using Rsync</h5>
|
|
<p>
|
|
Needs rsync v.2.5.7 or later
|
|
</p>
|
|
<pre>
|
|
rm -rf backup_folder.1
|
|
mv backup_folder.0 backup_folder.1 # Obviously, can have as many backups copies as you want
|
|
rsync -a --delete --link-dest=../backup_folder.1 source_directory/ backup_folder.0/
|
|
</pre>
|
|
<p>
|
|
If running an older rsync:
|
|
</p>
|
|
<pre>
|
|
mv backup_folder.1 backup_folder.tmp
|
|
mv backup_folder.0 backup_folder.1
|
|
mv backup_folder.tmp backup_folder.0
|
|
cp -al backup_folder.1/. backup_folder.0
|
|
rsync -a --delete source_directory/ backup_folder.0/
|
|
</pre>
|
|
|
|
</body>
|
|
</html>
|