Preserving ext2-4 attributes

Alan Stern stern at rowland.harvard.edu
Fri Dec 13 17:43:31 UTC 2019


I have searched for this topic on the mailing list and on Google 
without finding anything.  Is this already a well known issue?

The problem is that rsync does not preserve ext2-4 attributes (even
when using the -a, -A, and -X flags).  Note that these are different
from extended attributes: Extended attributes are manipulated using
programs such as getfattr and setfattr (on Unix-like systems), whereas
ext2-4 attributes are manipulated by programs such as lsattr and
chattr.  These attributes include features like "don't update atime" or
"immutable".

Here's an example (run as the superuser, so permissions aren't an 
issue).  A file x has no special attributes, then the "i" attribute is 
added and verified to be present.  rsync then copies x to y, but the 
"i" attribute is not set for y:

# lsattr x
--------------e---- x
# chattr +i x
# lsattr x
----i---------e---- x
# rsync -a -A -X x y
# lsattr y
--------------e---- y

What is the reason for this behavior?  Is there any way for rsync to
preserve these attributes?  If not, how can rsync be used to make a 
reliable complete system backup?

Thanks,

Alan Stern




More information about the rsync mailing list