LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   rsync question (https://www.linuxquestions.org/questions/linux-software-2/rsync-question-637552/)

mahmoud 04-24-2008 10:35 AM

rsync question
 
Hi
i am a bit confused first i have a nas storage device and a external hard disk
i mounted the storage device on /mnt
and the external hard drive on /media/disk
my goal is to copy from the storage device to the external hard disk so i did
rsync -vac --stats --delete /mnt/ /media/disk/fileserver-backup/

and this was the out put i was getting
deleting mnt/Contacts/Clients/.............

deleting mnt/Contacts/Clients/...............

deleting mnt/Contacts/Clients/...............

deleting mnt/Contacts/Clients/................

deleting mnt/Contacts/Clients/............

deleting mnt/Contacts/Clients/............

deleting mnt/Contacts/Clients/..............

deleting mnt/Contacts/Clients/..............

deleting mnt/Contacts/Clients/...........

deleting mnt/Contacts/Clients/...........

deleting mnt/Contacts/Clients/..........

deleting mnt/Contacts/Clients/..........

deleting mnt/Contacts/Clients/..........
that is just part of the output before i stopped it also the ......
is for security reasons
my question is why is it deleting the stuff on the storage device when the command stated

rsync [OPTION...] SRC... [DEST]

if it isnt deleting what is on the storage device what is it deleting

keratos 04-24-2008 01:15 PM

--delete will delete files from the SENDING side.

what are you trying to do EXACTLY.

i.e. are you trying to:

Clone a directory/filesystem?
or
Create a set of one-off backups?
or
Create incremental backups?

mahmoud 04-25-2008 03:13 AM

i was trying to back up the file on the storage device to the external drive
the external drive had a copy of the backups but it was about a few weeks old
so i was trying to update it so i can work on the storage device

billymayday 04-25-2008 03:27 AM

No, --delete deletes at the destination. What's happening is rsync compares what you are sending with what's there and because you have the delete option is cleaning up.

billymayday 04-25-2008 03:29 AM

From man rsync

Quote:

--delete
This tells rsync to delete extraneous files from the receiving side (ones that aren't on the sending side), but only for
the directories that are being synchronized. You must have asked rsync to send the whole directory (e.g. "dir" or
"dir/") without using a wildcard for the directory's contents (e.g. "dir/*") since the wildcard is expanded by the shell
and rsync thus gets a request to transfer individual files, not the files' parent directory. Files that are excluded
from transfer are also excluded from being deleted unless you use the --delete-excluded option or mark the rules as only
matching on the sending side (see the include/exclude modifiers in the FILTER RULES section).

Prior to rsync 2.6.7, this option would have no effect unless --recursive was in effect. Beginning with 2.6.7, deletions
will also occur when --dirs (-d) is in effect, but only for directories whose contents are being copied.

This option can be dangerous if used incorrectly! It is a very good idea to run first using the --dry-run option (-n) to
see what files would be deleted to make sure important files aren't listed.

If the sending side detects any I/O errors, then the deletion of any files at the destination will be automatically dis‐
abled. This is to prevent temporary filesystem failures (such as NFS errors) on the sending side causing a massive dele‐
tion of files on the destination. You can override this with the --ignore-errors option.

The --delete option may be combined with one of the --delete-WHEN options without conflict, as well as --delete-excluded.
However, if none of the --delete-WHEN options are specified, rsync will currently choose the --delete-before algorithm.
A future version may change this to choose the --delete-during algorithm. See also --delete-after.

mahmoud 04-25-2008 05:13 AM

So basically it was not deleting my files because it cause me quite a scare and also i checked for the files there were still there but from the out put that was the folders it was supposed to be deleting anyway thanks for you help next time i will definitely use a dry run first


All times are GMT -5. The time now is 10:04 PM.