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?