-1

Working through a backup script debug backup/restore on:

macStudio M1 / macOS Monterey <-> Synology DS920+

On the mac, I've downloaded HomeBrew rsync 3.2.4 On the synology, I'm running what it shipped with - rsync 3.1.2

For debug, I used /Volumes/Recovery which has files with owner set to root and group set to wheel.

src="/Volumes/Recovery/"
dest="$userID@$remoteIP::NetBackup/MacStudio1/Volumes/Recovery/
restore="/tmp/RestoreBackup/"

userID is has admin privileges on the NAS. rsync services are enabled on the NAS. user directories are enabled on the NAS.

Backup:

rsync -ahX --delete -M--fake-super $src $dest

Restore:

rsync -ahX --delete -M--fake-super $dest $restore

It all seems to work without error. Files are on restore as expected except I'm seeing the files have owner set to my ID.

for example, ls -laR shows (abridged) :

/Volumes/Recovery/E4A28DF2-7007-4ED8-A427-320FCCA8AC36/usr/standalone/firmware:
-rw-rw-rw-  1 root  wheel  1821914899 Jun  4 11:42 arm64eBaseSystem.dmg
/tmp/RestoreBackup//E4A28DF2-7007-4ED8-A427-320FCCA8AC36/usr/standalone/firmware:
-rw-rw-rw-  1 myID  wheel  1821914899 Jun  4 11:42 arm64eBaseSystem.dmg

I've looked at the rsync man (more than once) and I see words like "To affect the remote side of a remote-shell connection...". However, I'm not sure how to apply that to a backup or a restore.

Do I want to effect the remote side on the backup? Do I want to effect the remote side on the restore? Any guidance on what I should have set the options to?

Robert
  • 7,394
  • 40
  • 45
  • 64
ric982
  • 1
  • 2
  • I am actually fighting with a similar issue I guess. I believe it is clear that -M--fake-super will use extended attributes to store data on the remote end, but I have no idea how to tell rsync that I am trying to restore from there now, so please use those extended attributes now to set owners etc. back. I find the manual very blurry and unclear in this regard. – kralg Sep 18 '22 at 14:55

1 Answers1

0

So looks like I'm not getting any responses. Guess I'll wrap this up with my observations.

In testing I've done on a user directory (with test data files), the rsync is working to save and restore files with extended attributes (I verified they got set and that they matched on restore). So I think the overall switches on the rsync commands are correct.

The problems I'm seeing on backing up and restoring the "Recovery" volume have the following issues:

  1. All regular files have the wrong "owner". The groups look correct.
  2. The one linked directory has the wrong "owner" and the wrong "group".

I believe (1) problem is caused because I need to use sudo rsync on the restore. I'm guessing that the files that are backup up have the correct owner/group in metadata, but the restore doesn't have the authority to set the owner to 'root'. I tried using sudo briefly and it died with some errors I didn't quite understand. I believe I need to set up the etc/sudoers file with some information. The (2) problem may partially go away if I fix (1) or it may need some additional rsync flags to do with linked files and directories.

Overall, my backup script is working, but I'm now starting to question if I know enough to know what to backup on macOS. A rather length article by the CCC folk seems to explain this but it leaves me feeling I don't know enough above macOS data structures and it seems some of this may change over time when new version are released. I had started with the idea of just backuping up everything under /* (Macintosh HD), and perhaps this would work, though there are at least somethings that need to be excluded (like /Volumes/* and perhaps /tmp/* ). Also noticed that there is a /System tree that doesn't show up with ls /* that CCC folk say to leave alone. So not exactly got a good feeling I understand what I need to know.

So for the moment I'm going to sideline this effort. I've got Time Machine running to my NAS and I need to get the NAS backed up to a cloud first. My fall back positions are either (1) to just be dependent on TimeMachine only, (2) to buy and use CCC as a secondary backup, or (3) to create a backup with just my user directories as a secondary backup - which will require my reinstalling any 3rd party software in the event that I can't recover with Time Machine.

ric982
  • 1
  • 2