Thursday, 21 December 2017

Problem mounting XFS filesystem on Linux (Oracle Linux 7.4/RHEL 7.4, Red Hat Enterprise Linux Server release 7.4 (Maipo)

The problem

First of all I want to point out that this was done on Oracle Linux 7.4 only, in spite of the title including RHEL and CentOs. I included in the title this OS names because they are derivatives from RHEL and I expect that they all behave in the same way. If someone has tested this in any of this derivatives (or another) and found out that this is a problem (or not) pleas report so I can correct this post.

After creating a new LVM volume and building the Linux filesystem using mkfs.xfs I tried to mount it using the regular mount command, which didn't work.

The mount command reported the following error:
mount: wrong fs type, bad option, bad superblock on /dev/mapper/vg_data-lv_data_test,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

The messages log and journalctl reported:
 kernel: XFS (dm-11): bad version
 kernel: XFS (dm-11): SB validate failed


The solution
After a lot of investigation I found out the difference between the previous versions and this one when building a new xfs filesystem, which I am signaling below:
meta-data=/dev/mapper/vg_data-lv_data_test isize=256    agcount=4, agsize=58368 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0, sparse=0
data     =                       bsize=4096   blocks=233472, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

In red you can see that ftype=1 when the in the previous version we had as default ftype=0.

Here is a link to Oracle documentation (https://docs.oracle.com/cd/E52668_01/E88149/html/ol7-features-xfschange.html).

As I am not using docker, the solution is to provide the ftype parameter when building the xfs filesystem, like so and mount the filesystem in the usual way.
mkfs.xfs -n ftype=0 /dev/mapper/<device name>

Problem mounting XFS filesystem on Linux (Oracle Linux 7.4/RHEL 7.4, Red Hat Enterprise Linux Server release 7.4 (Maipo)

The problem First of all I want to point out that this was done on Oracle Linux 7.4 only, in spite of the title including RHEL and CentOs....