-3

I am learning how to use rysnc (version 3.0.9, protocol version 30) to do backup on a toy example, from a dir /tmp/pdf to a backup dir /tmp/backup, following http://schlutech.com/2011/11/rsync-full-incremental-differential-snapshots/.

First is a full backup:

$ mkdir /tmp/backup
$ ls /tmp/pdf
100  bkg.pdf  p1  stamp.pdf

$ rsync -a /tmp/pdf  /tmp/backup/`date +%Y.%m.%d_%H:%M:%S`/

$ ls /tmp/backup/
2015.02.26_08:36:40   
$ ls /tmp/backup/2015.02.26_08\:36\:40/
pdf
$ ls /tmp/backup/2015.02.26_08\:36\:40/pdf
100  bkg.pdf  p1  stamp.pdf

Then I add a new pdf file into the source dir:

$ cp /tmp/linux-kernel.pdf /tmp/pdf
$ ls /tmp/pdf
100  bkg.pdf  linux-kernel.pdf  p1  stamp.pdf

and do a incremental backup:

$ link_dest=`find /tmp/backup -maxdepth 1 -type d | sort | tail -n 1`
$ echo $link_dest
/tmp/backup/2015.02.26_08:36:40

$ rsync -au –link-dest=${link_dest} /tmp/pdf  /tmp/backup/`date +%Y.%m.%d_%H:%M:%S`/
rsync: change_dir "/tmp//–link-dest=/tmp/backup" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1070) [sender=3.0.9]

$ ls /tmp/backup/
2015.02.26_08:36:40  2015.02.26_08:55:47
$ ls /tmp/backup/2015.02.26_08\:55\:47/pdf/
100  bkg.pdf  linux-kernel.pdf  p1  stamp.pdf

Why is the rsync error above? It seems the second backup has capture the change to the source, i.e. the pdf file I added after the first backup, so I don't see anything wrong?

If it were you, how would you use rsync to do incremental backup? Thanks.

0

–link-dest should be --link-dest.

I copied –link-destfrom the linked webpage, and still don't know how to tell and - from each other in a webpage and in terminal. If you know, can you tell me? Thanks.

  • It looks like the whatever is displaying the page is converting -- into – (en-dash) as part of it's formatting. The only way to tell is to do what you did followed by oy vey or to remember that long-form command line options are generally preceded by -- and check/take appropriate sction. – user591 Feb 27 '15 at 6:51
  • One option to tell characters apart is the unicode utility. – Sparhawk Feb 14 '17 at 1:36
  • 4
    This is funny to me that even this lone answer is really a question. :D – Wildcard Aug 9 '17 at 0:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.