D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] rsync error.. tries to copy Trash folder

 

On 05/11/17 13:19, Julian Hall wrote:
> Hi All,
> 
> Doing a weekly backup of my NAS by rsync I keep getting an error when it
> tries to copy the Trash folder, which obviously I don't want it to copy
> anyway:
> 
> rsync: opendir "/media/julian/DIANA/.Trash-1000" failed: Permission
> denied (13)
> 
> I have tried excluding the specified folder as follows;
> 
> sudo rsync -aAXv /media/julian/CASSIOPEIA /media/julian/ARTEMIS/
> --delete --exclude={/media/julian/CASSIOPEIA/.Trash-1000}
> 
> However it seems to ignore the exclusion. It's not a huge problem as
> everything else copies properly, it's just an irritant.
> 
> Any thoughts please?


Either your copy/pasting has gone wrong or something more insidious is
afoot... Your command looks sorta legit, if formatted a bit strangely -
I'd do it like this:

rsync -aAXSv --delete --exclude{.Trash-1000} /media/julian/CASSIOPEIA
/media/julian/ARTEMIS/

Your excludes should be relative to the "left side" filepath which as
"/media/julian/CASSIOPEIA" means you only pass it the extra argument
".Trash-1000" rather than the full
"/media/julian/CASSIOPEIA/.Trash-1000" - but watch out for those
trailing slashes which will seriously effect rsync's behaviour.

More seriously, why are you using sudo? Presumably you're copying your
own files here, which you should have suitable permissions on at both
ends. Both "ends" here look like you've probably mounted them via NFS
right? Why not use rsync more traditionally to just sync from
user@source to user@dest over SSH - it's cleaner and you're less likely
to get yourself into trouble with permissions (again).

No wonder you keep running into crazy permissions issues on your NAS.
Currently you are using sudo to read all your files AND write them to
the source, which is going to end up preserving some unwanted bits and
potentially causing chaos on the destination side.

Finally, have a look at the error message more carefully:

rsync: opendir "/media/julian/DIANA/.Trash-1000" failed

I don't see DIANA anywhere in the rsnyc command you posted... did you
copy/paste the wrong thing somewhere?

When you're testing rsnyc commands remember to add --dry-run until
you're happy with them for obvious reasons.

Cheers



-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq