eminenz Tux's lil' helper
Joined: 16 Jul 2006 Posts: 95
|
Posted: Sat Dec 10, 2016 1:01 pm Post subject: odd rsync --link-dest --inplace behaviour on changed files |
|
|
Hi,
i wonder about my understanding of rsync and/or if rsync is behaving correctly.
I am using rsync to backup my server to a NFS shared NAS on /mnt/backup.
The backup share contains a list of folders for daily and weekly backups, i.e.
d_Di d_Do d_Fr d_Mi d_Mo d_Sa w_46 w_47 w_48
and a symlink designating the previous backup:
lrwxrwxrwx 1 root root 27 Dez 10 13:07 aktuell -> /mnt/backup/leihnix5h2/d_Fr
now, I run rsync by cron daily/weekly in a script, that does the following, among others:
Code: | ZEIT=d_$(date +%a)
rsync -ah --delete --delete-excluded --inplace --link-dest=/mnt/backup/aktuell /dmtc /mnt/backup/$ZEIT
rm /mnt/backup/aktuell; ln -s /mnt/backup/$ZEIT /mnt/backup/aktuell |
this correctly creates copies of all changed files from /dmtc in (i.e.)/mnt/backup/d_Fr/dmtc/dir1/... and hardlinks to the unchanged files in aktuell.
but not all of them. I also have a mysqldump-cronjob running twice a day
/usr/bin/mysqldump -A -u root -p(secret) -E --single-transaction | gzip -9 > /dmtc/buswp/mysql/mysql-$(hostname)-$(date +\%a_\%H).gz, creating 14 dumps of ~200MB each that are cyclically updated.
rsync fails in their handling. The dumps do not show up as changed, however they are. If I add rsync -i, they don't show up in the changes list.
On the backup filesystem, the files show up with the new dates and sizes and are upgraded backwards in time.:
An example:
current server files:
-rw-r--r-- 1 root root 216671813 Dec 6 12:25 mysql-leihnix5h2-Di_12.gz
-rw-r--r-- 1 root root 216848076 Dec 6 22:26 mysql-leihnix5h2-Di_22.gz
-rw-r--r-- 1 root root 217466686 Dec 8 12:25 mysql-leihnix5h2-Do_12.gz
-rw-r--r-- 1 root root 217645140 Dec 8 22:25 mysql-leihnix5h2-Do_22.gz
-rw-r--r-- 1 root root 217818620 Dec 9 12:26 mysql-leihnix5h2-Fr_12.gz
-rw-r--r-- 1 root root 217954590 Dec 9 22:25 mysql-leihnix5h2-Fr_22.gz
-rw-r--r-- 1 root root 217070668 Dec 7 12:25 mysql-leihnix5h2-Mi_12.gz
-rw-r--r-- 1 root root 217246604 Dec 7 22:25 mysql-leihnix5h2-Mi_22.gz
-rw-r--r-- 1 root root 216269783 Dec 5 12:25 mysql-leihnix5h2-Mo_12.gz
-rw-r--r-- 1 root root 216450441 Dec 5 22:25 mysql-leihnix5h2-Mo_22.gz
-rw-r--r-- 1 root root 218118587 Dec 10 12:26 mysql-leihnix5h2-Sa_12.gz
-rw-r--r-- 1 root root 215653860 Dec 3 22:25 mysql-leihnix5h2-Sa_22.gz
-rw-r--r-- 1 root root 215874745 Dec 4 12:25 mysql-leihnix5h2-So_12.gz
-rw-r--r-- 1 root root 216051956 Dec 4 22:25 mysql-leihnix5h2-So_22.gz
todays backup files on NAS:
-rw-r--r-- 10 root root 216671813 Dez 6 12:25 mysql-leihnix5h2-Di_12.gz
-rw-r--r-- 10 root root 216848076 Dez 6 22:26 mysql-leihnix5h2-Di_22.gz
-rw-r--r-- 8 root root 217466686 Dez 8 12:25 mysql-leihnix5h2-Do_12.gz
-rw-r--r-- 10 root root 217645140 Dez 8 22:25 mysql-leihnix5h2-Do_22.gz
-rw-r--r-- 10 root root 217818620 Dez 9 12:26 mysql-leihnix5h2-Fr_12.gz
-rw-r--r-- 10 root root 217954590 Dez 9 22:25 mysql-leihnix5h2-Fr_22.gz
-rw-r--r-- 10 root root 217070668 Dez 7 12:25 mysql-leihnix5h2-Mi_12.gz
-rw-r--r-- 10 root root 217246604 Dez 7 22:25 mysql-leihnix5h2-Mi_22.gz
-rw-r--r-- 9 root root 216269783 Dez 5 12:25 mysql-leihnix5h2-Mo_12.gz
-rw-r--r-- 9 root root 216450441 Dez 5 22:25 mysql-leihnix5h2-Mo_22.gz
-rw-r--r-- 10 root root 218118587 Dez 10 12:26 mysql-leihnix5h2-Sa_12.gz
-rw-r--r-- 10 root root 215653860 Dez 3 22:25 mysql-leihnix5h2-Sa_22.gz
-rw-r--r-- 7 root root 215874745 Dez 4 12:25 mysql-leihnix5h2-So_12.gz
-rw-r--r-- 7 root root 216051956 Dez 4 22:25 mysql-leihnix5h2-So_22.gz
backup on nas from wednesday 7th:
-rw-r--r-- 10 root root 216671813 Dez 6 12:25 mysql-leihnix5h2-Di_12.gz
-rw-r--r-- 10 root root 216848076 Dez 6 22:26 mysql-leihnix5h2-Di_22.gz
-rw-r--r-- 8 root root 217466686 Dez 8 12:25 mysql-leihnix5h2-Do_12.gz
-rw-r--r-- 10 root root 217645140 Dez 8 22:25 mysql-leihnix5h2-Do_22.gz
-rw-r--r-- 10 root root 217818620 Dez 9 12:26 mysql-leihnix5h2-Fr_12.gz
-rw-r--r-- 10 root root 217954590 Dez 9 22:25 mysql-leihnix5h2-Fr_22.gz
-rw-r--r-- 10 root root 217070668 Dez 7 12:25 mysql-leihnix5h2-Mi_12.gz
-rw-r--r-- 10 root root 217246604 Dez 7 22:25 mysql-leihnix5h2-Mi_22.gz
-rw-r--r-- 9 root root 216269783 Dez 5 12:25 mysql-leihnix5h2-Mo_12.gz
-rw-r--r-- 9 root root 216450441 Dez 5 22:25 mysql-leihnix5h2-Mo_22.gz
-rw-r--r-- 10 root root 218118587 Dez 10 12:26 mysql-leihnix5h2-Sa_12.gz
-rw-r--r-- 10 root root 215653860 Dez 3 22:25 mysql-leihnix5h2-Sa_22.gz
-rw-r--r-- 7 root root 215874745 Dez 4 12:25 mysql-leihnix5h2-So_12.gz
-rw-r--r-- 7 root root 216051956 Dez 4 22:25 mysql-leihnix5h2-So_22.gz
which is IDENTICAL!
In difference to many other files (that are mostly smaller and uncompressed, don't know if that's a possible reason) for which that backup works, rsync seems to do the following:
*it copies the new files (diff shows no difference between server and backup!) to the backup location
*it does NOT show the copy in the itemized changed list
*due to the unhandled copy, it does break the hard-link to 6 other differing versions of the dump file, and now all old versions in all past backups are overwritten
--that's what I perceive. can somebody help me solve that issue and get a the mysql dumps to backup correctly?
Last edited by eminenz on Sat Dec 10, 2016 2:32 pm; edited 1 time in total |
|