CentOS/RHEL: Mount Command Fails With “mount: does not contain SELinux labels”

The Problem

Getting below error message when trying to mount a filesystem:

# mount /dev/mapper/vg-lv /mnt
mount: /mnt does not contain SELinux labels.
     You just mounted an file system that supports labels which does not
     contain labels, onto an SELinux box. It is likely that confined
     applications will generate AVC messages and not be allowed access to
     this file system. For more details see restorecon(8) and mount(8).
mount: /dev/mapper/vg-lv mounted on /mnt.

Even though the output shows the device was mounted, it was actually not, which can be confirmed with commands such as df or mount.

The Solution

The partition’s SELinux context is incorrect. The correct context needs to be set in order to be able to mount the partition.

Relabel the filesystem by creating /.autorelabel followed by a reboot or perform restorecon on the filesystem:

# touch /.autorelabel
# reboot

or

# restorecon -Rv /
Related Post