LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-04-2013, 04:16 AM   #1
maikelmeyers
LQ Newbie
 
Registered: May 2008
Posts: 13

Rep: Reputation: 0
rsync in conjunction with the --link-dest option does not output deleted files


Hi,

I want to use rsync to make daily backups using hard-links.
see here: http://www.howtoforge.com/backing-up...rsions-history
or here: http://www.backupcentral.com/wiki/in...sync_snapshots
This works great, but the problem is, that rsync does not output deleted files, but I want to write this information into a log file. Without using the --link-dest option it shows deleted files correctly.
Look at this simple example. cd into an empty directory and execute this script to see what I mean. Is this a bug, or ist this intended to be or am I wrong somethere?

Code:
#!/bin/bash

echo -e "\n  --> creating a test source dir with 2 files (file1,file2) in it"
echo -e "  --> 1st backup of this dir with rsync (without --link-dest option)"
echo -e "  --> the output of rsync shows the 2 created files\n"
mkdir source
touch source/file1
touch source/file2
rsync -av --delete ./source/. ./backup

echo -e "\n  --> creating a new file (file3) in source dir"
touch source/file3

echo -e "  --> 2nd backup of this dir with rsync (without --link-dest option)"
echo -e "  --> the output of rsync shows the new created file (file3)\n"
rsync -av --delete ./source/. ./backup

echo -e "\n  --> deleting file1 in source dir"
rm source/file1

echo -e "  --> 3rd backup of this dir with rsync (without --link-dest option)"
echo -e "  --> the output of rsync shows the deleted file (file1)\n"
rsync -av --delete ./source/. ./backup


echo -e "\n  --> now the same procedure with the --link-dest option"
rm -r source
rm -r backup

echo -e "  --> creating a test source dir with 2 files (file1,file2) in it"
echo -e "  --> 1st backup of this dir with rsync"
echo -e "  --> the output of rsync shows the 2 created files\n"
mkdir source
touch source/file1
touch source/file2
rsync -av --delete ./source/. ./backup

echo -e "\n  --> creating a new file (file3) in source dir"
touch source/file3

echo -e "  --> 2nd backup of this dir with rsync (with --link-dest option)"
echo -e "  --> the output of rsync shows the new created file (file3)\n"
rsync -av --delete --link-dest=../backup ./source/. ./backup2

echo -e "\n  --> deleting file1 in source dir"
rm source/file1

echo -e "  --> 3rd backup of this dir with rsync (with --link-dest option)"
echo -e "  --> the output of rsync does not show the deleted file!!! (file1)\n"
rsync -av --delete --link-dest=../backup2 ./source/. ./backup3
 
Old 01-04-2013, 04:51 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Lightbulb

You could create pre & post lists then use a utility like diff to compare to get yoiur list.



Code:
touch /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
date >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
ls /home/joe/ -lhR >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
ls /media/N-Space/ -lhR >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"
echo "************************************************************************" >> /home/joe/System-Logs/Back-Up/"Back_UP_Record--$(date +%F)"



find /home/joe/System-Logs/Back-Up/ -mtime -1 -and -type f -exec diff -u {} + | grep ^+ > /home/joe/System-Logs/Removed/"change--$(date +%F)"

rsync functions.....

Last edited by jv2112; 01-04-2013 at 04:53 AM.
 
Old 01-04-2013, 05:29 AM   #3
maikelmeyers
LQ Newbie
 
Registered: May 2008
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jv2112 View Post
You could create pre & post lists then use a utility like diff to compare to get yoiur list.
But can you reproduce the problem with rsync? Do you think this is a bug?
 
Old 01-04-2013, 05:06 PM   #4
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
No Dice
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Questions about rsync and '--link-dest' flag donnaaparis Linux - General 1 07-14-2011 12:55 PM
rsync log format option (--link-dest) rbalaa Linux - Server 2 04-03-2010 09:53 AM
[SOLVED] rsync --link-dest not creating hard links on external usb drive quasi3 Linux - General 4 08-26-2009 10:11 AM
Problem using rsync for backups: link-dest JosephS Linux - Software 0 02-21-2008 07:43 AM
make rsync output deleted files? hawarden Linux - Software 8 03-18-2005 12:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration