Clean way to preserve permissions in backups from Linux stored on NTFS

0

With cygwin, rsync and SSH I have set up a backup mechanism that copies all of the vServers (running Debian) contents to my local NTFS hard drive (running Windows 10) and it works. Partially.

I use this command:

rsync -avzu --no-perms \
  --exclude 'bin' \
  --exclude 'dev' \
  [...]
  --exclude 'sys' \
  --exclude 'tmp' \
  --exclude 'var/tmp' \
  --exclude 'var/cache' \
  [user]@[domain]:/ /var/vserver-backup

And of course it makes all files lose their permissions as they are copied (that is because of the --no-perms argument). Also I am not quite sure whether I will be able to copy symbolic links back to the vServer correctly.

What I want is, that the local files (the copies) are accessible by myself on this local computer (using NTFS). Because the Linux permissions would be mapped wildly to any of my local computers accounts and thus be maybe not accessible, using NTFS-ACL seems not a good idea, right? On the other hand I want to be able to cleanly restore that backup including ACL's and symlinks. And yes, the vServer has set extended ACL's on some files and even directories (set using setfacl).

This probably would be possible if I used tar instead of rsync, wouldn't it? But that would take massively more time as it would not only transmit the delta, right? (I am not sure about tar being a possibility at all...)

So is there maybe a way on Debian, to automatedly create a file containing the permissions of all files and the locations of symlinks, so that it can be executed after restoring the backup? I imagine it being a shell script in this format:

chown root:root /var
chmod 0755 /var
chown root:root /var/data
chmod 0755 /var/data
[...]
ln -s /etc/some/file /etc/path/to/symlink
[...]
chown root:root /www
chmod 0700 /www
setfacl -d -m g:www-data:rx /www

This file would of course be created on the server side and be copied by the rsync command to the local hard drive along with all other files.

Is there a known way to do that? Or do you have any other suggestions? What would you do?

Matmarbon

Posted 2015-08-12T08:18:08.670

Reputation: 135

1I'd use tar.... – qasdfdsaq – 2015-08-12T10:21:03.733

@qasdfdsaq But that would require me to have in the worst case twice as much space on the vServer as it needs for the data itself. I do not want to rely on that. – Matmarbon – 2015-08-12T10:23:20.873

No, you'd exactly the same amount of space as to store the files normally – qasdfdsaq – 2015-08-12T10:24:49.973

@qasdfdsaq But where will the tar archive be stored? At least on creation time it needs to be on the vServer and thus takes in the worst case as much space as the files themselves. So I need twice as much space as I would need normally. – Matmarbon – 2015-08-12T10:27:31.613

1It's stored wherever you are writing the current backups to – qasdfdsaq – 2015-08-12T10:28:33.123

In the end, yes (after I transmitted it). But is there any way on earth, that lets me create the archive without taking space on the vServer before I transmit it to my local hard drive? – Matmarbon – 2015-08-12T10:30:48.670

Let us continue this discussion in chat.

– Matmarbon – 2015-08-12T11:07:49.693

No answers