On Fri, May 28, 2010 at 03:56:00PM +0200, Matteo Sgalaberni wrote:
> do you know if there are ways to restore file attributes (uid/gid,
> permissions) fetching file attributes from BackupPC?
I will reply to myself...I hope that this will be useful for someone
First export a list of the files on the backup:
# /usr/local/BackupPC/bin/BackupPC_tarCreate -h $hostname -n 1 -s "/" -L > backup.list
it will return in the output file some like this:
100755 0/0 26860 ./bin/cat
100755 0/0 45344 ./bin/chgrp
create this script file "parse_perms.py":
import sys, re
dati = sys.stdin.readline()
if dati == "": break
dati = re.findall("([^ ]+)", dati)
bits = dati[-4:]
uidgroup = (dati).replace("/",".")
path = dati.replace("\n","")
print "chmod %s %s" % (bits, path)
print "chown %s %s" % (uidgroup, path)
afterthat parse the "backup.list" with that script:
# cat backup.list | python parse_perms.py > commands.sh
now in commands.sh you will have all chmod/chown commands ready to be executed
on the target server and restore all permissions as was on the backup snapshot.
From: Chris Bennett <chris@ce...> - 2010-06-02 07:18:05
> First export a list of the files on the backup:
How did you restore the data to start with? I've restored via
rsync-over-ssh, tarvall 'archive' (e.g. archive host) and tarball
download and permissions are carried across in all cases.
I noticed an issue with incorrect name/group permissions in a
partciular corner case, but that's different from having to
chown/chgrp the entire restored tree like you're suggesting.
I'm curious to know what you've observed for this that required you to