Unix Executable on NAS backup use RSync

I spent the last few weeks working though some issues and finally found the solution. I did a lot of searching and never found an answer, so I figured I would share the knowledge I've gleamed through dozens of other post and my own trial and error.


Maybe it'll help someone else.


There were several pieces to the problems I had. I'll explain and give my solution...


First, I work in a graphics department and we have a Drobo5N2 NAS for us to house our files. We also have a Synology DS918+ in a different part of the building. For quite a while, our Windows Server had been using Robocopy to mirror the files from the Drobo to the Synology NAS. I recently checked the logs and found thousands of files and over 17 GB of files that had errors.


Here's some error codes to help others when searching...

  • ERROR 2 (0x00000002)
  • ERROR 1168 (0x00000490)


So I figured out many of them were Mac naming characters that Windows didn't accept. Therefore, it just skipped. Others, I'm still not sure what the problem was. I would try to copy using my Windows PC and it kept saying the file wasn't found... even though I could browse to it and see it.


I ultimately landed on using my Mac Pro to run a backup since Windows obviously wasn't going to work. I tried Get Backup Pro, which worked great for most everything. The one problem it was having is Mac files without an extension. When they copied through my network, they became Unix Executable files.


I know I could go through and open in Text Editor, look for the program that created it and open directly or add an extension myself. But the Drobo has a culmination of 15 years worth of graphics files and that would take forever... I wanted the attributes and resource forks.


I tried RSync, but the Mac's version of RSync is old and even including -E for extended attributes didn't work... RSync still changed these non-extensioned files into Unix Executables.


So I decided to update my RSync. I saw several tutorials on how to do this. One mentioned that other programs could use RSync and if I just update the Mac's default version, it could effect other programs. I decided to install into a different folder.


I didn't really trust the "homebrew" versions because I never know what someone else does to the files. Maybe I'm paranoid, but I figured if it doesn't come from the manufacturer, the creator could leave a hack in there to collect personal information and passwords.


I tried and failed to install the version on Samba.org. Perhaps because I was trying to use Homebrew directions and original files, but I never did get that to work.


So I cheated. I remembered when I was looking at the logs for Get Backup Pro that it included RSync 3.1.3. So I opened terminal and was able to point my RSync code to the Package inside my Applications folder. I figure since RSync is open source, there wasn't anything illegal about doing this.


I had created a test folder on my Drobo with a few MB of files I knew had issues... from file names with special characters, files without extensions and a folder that my PC said it couldn't copy.


I used this RSync code:


/Applications/Get\ Backup\ Pro\ 3.app/Contents/Resources/rsync3 -aE --xattrs --stats --delete /Source/ /Destination --log-file=/Users/name/Desktop/Logs/rsync_`date +%Y-%m-%d`.log


The key is the --xattrs option. This is what transferred the appropriate mac attributes. This option is not in the 10 year old default RSync that came with the mac, so you have to use a newer version.


I did reach out to Get Backup Pro to see if this option was something their software could use and they replied that it could not. They suggested I use Terminal.


My next issue is automation. I didn't want to have to open my network drives and terminal and run this code every night. SO I wrote a few lines of code to open each NAS (afp of course), sleep for 30 seconds while it loads and then run the RSync script. I used the Mac Automator.app. Chose Run Shell Script and entered my whole script.


Saved it as RSync Backup.app and then opened my Calendar app. I set a schedule to run every night and for the alert, it runs this app.


That's it... the next day I check the log and all of my files were copied over perfectly. I spot checked several folders and files throughout and everything was spot on, down to the byte.


I wish something like this came up in my search engine when I started this saga. I hope it helps someone else.


I'm happy to hear if anyone has some efficiency improvements.


Enjoy.

Mac Pro, macOS 10.14

Posted on May 7, 2020 1:06 PM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Unix Executable on NAS backup use RSync

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.