Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Currently I am trying to imagine a way of backing up all the file attributes and permissions of a certain directory, i.e. /volatile, for later restore. The procedere I have in mind would be:

  • backing up all the file attributes in /volatile
  • update /volatile (cloned from a git repo)
  • restore the file attributes to the new files

File attributes which should be preserved are for example, ownership and access rights as well as setuid-bits, etc ...

How would I do that if the file and directory structure is always completly identical and how would I do that if there are minor changes (i.e. one file deleted).

Any ideas are greatly appreciated.

Thanks in advance

share|improve this question
1  
Which filesystem (FAT/NTFS/ext3...)? –  schnaader Feb 19 '11 at 1:21
    
filesystem is ext3 –  ftiaronsem Feb 19 '11 at 21:17
add comment

1 Answer

up vote 9 down vote accepted

This will restore Unix file permissions, POSIX ACLs, and (if setfacl run as root) file ownership:

getfacl -R /volatile > /backup/acls
cd / && setfacl --restore /backup/acls

This will restore ext3/XFS extended attributes (xattrs):

getfattr -Rd /volatile > /backup/xattrs
cd / && setfattr --restore /backup/xattrs
share|improve this answer
    
Thanks, alot. Perfect anwer. –  ftiaronsem Feb 26 '11 at 21:38
3  
I'm not an alot ._. –  grawity Nov 24 '13 at 13:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.