rsync server backup, but now created folder I can't delete / view!


  1. Posts : 100
    Windows 10
       #1

    rsync server backup, but now created folder I can't delete / view!


    Hi,

    I'm trying to get a rsync scheduled task setup on my PC, that will do a rsync on my server and grab the files. So after a lot of hassle (getting the SSH key-pair working), I've finally got it going. My issue though, is that I was running this:

    Code:
    rsync -vcr -e "ssh -l root -i /cygdrive/F/ServerBackups/foo" "mysite.com:/srv/www/xxxx" "/cygdrive/F/ServerBackups/Foo"
    For some reason that has done some weird stuff with the permissions. After reading up a bit on it, I found I should have really used the --chmod=ugo=rwX flag as well, to set the permissions. This is what I'm using now:

    Code:
    rsync -vcr --chmod=ugo=rwX -e "ssh -l root -i /cygdrive/F/ServerBackups/foo" "mysite.com:/srv/www/xxxx" "/cygdrive/F/ServerBackups/Foo2"
    That works fine, and I can read Foo2, and all its contents. The proble now is getting rid of the "bad" one!

    Andy@Andy-PC /cygdrive/F/ServerBackups
    $ chmod 755 Foo
    chmod: changing permissions of 'Foo': Permission denied
    In Cygwin, here is this chmod's of that folder:

    Andy@Andy-PC /cygdrive/F/ServerBackups
    $ ls -lh
    -rw-------+ 1 Andy Andy 1.7K Oct 25 10:13 foo
    -rwxr-xr-x+ 1 Andy Andy 0 Oct 25 08:57 known_hosts
    d---rwxrwx+ 1 Andy Andy 0 Oct 25 10:21 Foo
    drwxrwx---+ 1 Andy Andy 0 Oct 25 10:32 Foo2
    Here is the permissions of the folder that I'm having issues with:

    rsync server backup, but now created folder I can't delete / view!-2016-10-25-10-41-02.jpg

    It has read-only ticked, so I have tried to remove that:
    rsync server backup, but now created folder I can't delete / view!-2016-10-25-10-40-48.jpg

    but then I just get this nasty error:
    rsync server backup, but now created folder I can't delete / view!-2016-10-25-10-41-26.jpg

    The folder is only a couple of hundred Mb's, but I'd still like to try and get rid of it if I can, so I can do some housekeeping =)T

    Thanks!

    Andy
      My Computer


  2. Posts : 9,788
    Mac OS Catalina
       #2

    You are talking about stuff that is advanced user, not something for the faint of heart, since it can royally screw up the system you are wanting to back up. See The Non-Beginners Guide to Syncing Data with Rsync rsync.net Cloud Storage for Offsite Backups (Mentions about Server 2008, but will work with regular Windows) rsync + ssh + cygwin - full and TOTAL instructions - Windows 2008 R2 - YouTube More info rsync

    Just know that you can hose up your Windows system and the device that you are using for the storage if you do this wrong. Use Macrium backup on your windows machine before you mess around with Rsync.
      My Computer


  3. Posts : 100
    Windows 10
    Thread Starter
       #3

    Thanks bro :) I actually have it all working (its backing up 6 of my sites now perfectly, and is set to run in the morning at 9am, after the server backups have finished. The only issue I have, is removing the "incorrect" one I did to start with. Maybe I'll just leave it, as its only a few hundred mb (on a 500gb SSD), so not wasting too much space. I was just hoping there was a simple fix :)

    CheersAn
    dy
      My Computer


  4. Posts : 9,788
    Mac OS Catalina
       #4

    I sent a message to Jimbo45 regarding this. He has been doing a lot of advanced stuff with Linux that I do not get into. With rsync there really is not a simple fix, because of how complex it is to make it work properly. We are talking old school tech, that rsync came out five years after Linus gave us Linux.

    If I do stuff with a test server running any form of Linux, I use webmin to let me do stuff that way.
      My Computer


  5. Posts : 100
    Windows 10
    Thread Starter
       #5

    Cool. thanks! Yeah it's tricky using a wrapped like Cygwin to emulate a *nix backend so that it can run. It's worked really well for me so far (all my sites are backed up locally, and it's doing the morning backup now, and only downloading the changed files :))

    Cheers

    Andy
      My Computer


  6. Posts : 1
    Windows 10
       #6

    Solved!


    I just came across this thread after looking for a solution to a similar problem.

    I was using rsync under cygwin on Windows 10 to perform some backups and used a command similar to the OP:
    Code:
    rsync -rltvWi --del '/cygdrive/c/big/foo/bar' '/cygdrive/c/big/bak/foo/'
    This created a folder at C:\big\bak\foo\bar that could not be opened, deleted, **or** have its permissions changed at all.
    It also could not be deleted using cygwin "rm -rf" or using Windows Subsytem for Linux as root. Cygwin "chmod" and "chown" could not operate on it either.
    It was truly a fubared directory. The **only** thing I could do was rename the "bar" directory to something else ("bar.TRASH").

    First of all, the solution for creating this nightmare in the first place was to edit the /etc/fstab file in cygwin and append ",noacl" to the entry for the "/cygdrive" volume.
    This allowed the above rsync command to complete successfully and create a backup directory that could be browsed and interacted with normally.

    Finally, the solution to delete the fubared directory was to use cygstart for privilege escalation as follows. Note, this can be done from either a cygwin or cmd terminal:

    Code:
    cd /cygdrive/c/big/bak/foo/
    cygstart --action=runas rm -rf bar.TRASH
    This results in a Windows UAC prompt for Administrator privileges to run "rm" which was then successful in deleting the undesired directory.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:49.
Find Us




Windows 10 Forums