LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-31-2019, 01:01 PM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,712

Rep: Reputation: 136Reputation: 136
rsync not deleting files on destination


From host WEB I am mounting a Windows drive (host DBSERVER). I am also nfs-mounting a Linux directory from host NAS. I am copying files from the Windows mountpoint to the nfs (NAS) mountpoint using the command:
Code:
rsync -tvd --delete --exclude='System Volume Information' --exclude='$RECYCLE.BIN' \
       /mnt/tmp/dbserverOffsite* /OHPRSstorage/Acronis/workstations/dbserver/
where /mnt/tmp is the Windows source mountpoint and /OHPRSstorage is the Linux/nfs destination mountpoint. The problem is --delete doesn't seem to be working. The files on the Windows share are:
Code:
# ls -l
total 96040952
drwxr-xr-x 2 root root           0 2019-01-20 01:51 System\ Volume\ Information/
-rwxr-xr-x 1 root root 28149164032 2019-01-21 19:55 dbserverOffsiteC_full_b1_s1_v1.tib*
-rwxr-xr-x 1 root root  1567226368 2019-01-27 19:35 dbserverOffsiteC_inc_b1_s2_v1.tib*
-rwxr-xr-x 1 root root    54076928 2019-01-28 19:34 dbserverOffsiteC_inc_b1_s3_v1.tib*
-rwxr-xr-x 1 root root    89477120 2019-01-29 19:34 dbserverOffsiteC_inc_b1_s4_v1.tib*
-rwxr-xr-x 1 root root   445394432 2019-01-30 19:34 dbserverOffsiteC_inc_b1_s5_v1.tib*
-rwxr-xr-x 1 root root 33510063104 2019-01-28 01:35 dbserverOffsiteF_full_b2_s1_v1.tib*
-rwxr-xr-x 1 root root    89716224 2019-01-28 20:00 dbserverOffsiteF_inc_b2_s2_v1.tib*
-rwxr-xr-x 1 root root      220160 2019-01-28 23:44 dbserverOffsiteF_inc_b2_s3_v1.tib*
-rwxr-xr-x 1 root root    87052288 2019-01-29 20:00 dbserverOffsiteF_inc_b2_s4_v1.tib*
-rwxr-xr-x 1 root root    89878528 2019-01-30 20:00 dbserverOffsiteF_inc_b2_s5_v1.tib*
But the destination has:
Code:
# ls -l
total 95630216
-rwxr-xr-x  1 ohprso ohprs 28149164032 2019-01-21 19:55 dbserverOffsiteC_full_b1_s1_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs  1567226368 2019-01-27 19:35 dbserverOffsiteC_inc_b1_s2_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs    54076928 2019-01-28 19:34 dbserverOffsiteC_inc_b1_s3_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs    89477120 2019-01-29 19:34 dbserverOffsiteC_inc_b1_s4_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs   445394432 2019-01-30 19:34 dbserverOffsiteC_inc_b1_s5_v1.tib*
-rwxr-x---  1 ohprso ohprs 32993155584 2019-01-21 05:28 dbserverOffsiteF_full_b1_s1_v1.tib*
-rwxr-x---+ 1 ohprso ohprs 33510063104 2019-01-28 01:35 dbserverOffsiteF_full_b2_s1_v1.tib*
-rwxr-x---  1 ohprso ohprs      218112 2019-01-21 20:00 dbserverOffsiteF_inc_b1_s2_v1.tib*
-rwxr-x---  1 ohprso ohprs    89340928 2019-01-22 20:00 dbserverOffsiteF_inc_b1_s3_v1.tib*
-rwxr-x---  1 ohprso ohprs    73085952 2019-01-24 00:21 dbserverOffsiteF_inc_b1_s4_v1.tib*
-rwxr-x---+ 1 ohprso ohprs    19802624 2019-01-24 20:00 dbserverOffsiteF_inc_b1_s5_v1.tib*
-rwxr-x---+ 1 ohprso ohprs   515232768 2019-01-25 20:00 dbserverOffsiteF_inc_b1_s6_v1.tib*
-rwxr-x---+ 1 ohprso ohprs      222720 2019-01-26 20:00 dbserverOffsiteF_inc_b1_s7_v1.tib*
-rwxr-x---+ 1 ohprso ohprs    89716224 2019-01-28 20:00 dbserverOffsiteF_inc_b2_s2_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs      220160 2019-01-28 23:44 dbserverOffsiteF_inc_b2_s3_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs    87052288 2019-01-29 20:00 dbserverOffsiteF_inc_b2_s4_v1.tib*
-rwxr-xr-x+ 1 ohprso ohprs    89878528 2019-01-30 20:00 dbserverOffsiteF_inc_b2_s5_v1.tib*
-rwxr-xr-x  1 root   ohprs    56250368 2019-01-15 20:30 dbserverOffsiteF_inc_b2_s6_v1.tib*
As you can see, there are a bunch of older dbserverOffsiteF* files on the destination which are not on the source. Why is --delete not working?

Last edited by mfoley; 01-31-2019 at 01:03 PM.
 
Old 01-31-2019, 01:10 PM   #2
l0f4r0
Member
 
Registered: Jul 2018
Location: Paris
Distribution: Debian
Posts: 887

Rep: Reputation: 288Reputation: 288Reputation: 288
Is rsync launched via root?
Is your Linux nfs mounted in read-only mode?

Last edited by l0f4r0; 01-31-2019 at 01:13 PM.
 
Old 01-31-2019, 02:36 PM   #3
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,105

Rep: Reputation: 632Reputation: 632Reputation: 632Reputation: 632Reputation: 632Reputation: 632
Quote:
Originally Posted by mfoley View Post
From host WEB I am mounting a Windows drive (host DBSERVER). I am also nfs-mounting a Linux directory from host NAS. I am copying files from the Windows mountpoint to the nfs (NAS) mountpoint using the command:
Code:
rsync -tvd --delete --exclude='System Volume Information' --exclude='$RECYCLE.BIN' \
       /mnt/tmp/dbserverOffsite* /OHPRSstorage/Acronis/workstations/dbserver/
Why is --delete not working?
As you're using a wildcard (*) in the source, you're NOT synchronizing directories but a bunch of individual files - the wildcard is expanded by the shell before even rsync starts.
As the man page clearly says:
Code:
--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.
Thus only when the source is a directory, either with or without a trailing / will the --delete option (and its variations like --delete-during etc) work, because it then tries to sync the whole directory.

Last edited by ehartman; 01-31-2019 at 02:40 PM. Reason: reformatted quote from man page
 
3 members found this post helpful.
Old 02-01-2019, 10:55 AM   #4
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 1,712

Original Poster
Rep: Reputation: 136Reputation: 136
ehartman: The wildcard thing makes sense. I'll have to build a cleanup bit into the script running the rsync.
 
  


Reply

Tags
delete, rsync


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
rsync => sync folders, delete 'extra' files at destination, do not preserve permissio Shay Linux - Software 1 05-08-2014 07:16 PM
Rsync - Only copy files that do not exist at the destination directory? wh33t Linux - Software 3 03-02-2014 06:30 PM
rsync -avz is deleting files from the destination wh33t Linux - Software 9 06-01-2012 03:32 AM
Rsync deleting files from destination directory Russell P Linux - Newbie 2 07-14-2011 12:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:34 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration