50.2.2. Relabeling a File System
The recommended method for relabeling a file system is to reboot the machine. This allows the
init process to perform the relabeling, ensuring that applications have the correct labels when they are started and that they are started in the right order. If you relabel a file system without rebooting, some processes may continue running with an incorrect context. Manually ensuring that all the daemons are restarted and running in the correct context can be difficult.
init.rcchecks for the existence of
/.autorelabel. If this file exists, SELinux performs a complete file system relabel (using the
/sbin/fixfiles -f -F relabelcommand), and then deletes
It is possible to relabel a file system using the
fixfiles command, or to relabel based on the RPM database:
fixfiles -R <packagename> restore
fixfilesto restore contexts from packages is safer and quicker.
fixfileson the entire file system without rebooting may make the system unstable.
fixfiles relabelprompts for approval to empty
/tmp/because it is not possible to reliably relabel
fixfilesis run as root, temporary files that applications are relying upon are erased. This could make the system unstable or behave unexpectedly.