The preservation of SELinux context is not maintained during a rsync operation due to the absence of the xattr feature on the target NFS file system. Running rsync with the options -X does not preserve SELinux context and observes apparent errors such as ** security.selinux failed: Operation not supported.
Method 1 – Utilize the tar command with the selinux option
tar –selinux -cvf archive.tar /path/to/filesMethod 2 – Backup and restore extended attributes.
getfattr -Rd -m – / > /tmp/all_xattrsPerform a restore as follows:
cd / setfattr –restore /tmp/all_xattrsDiagnostics
- cd to the mounted filesystem.
- Execute the following command:
- Expected error: