I'm running a fully updated Ubuntu 9.04 "Jaunty" i686 server. I have an single XFS volume in an LVM group called /dev/mapper/vg0-bigthree
.
If I boot to single user mode and ensure that the volume is unmounted, I still get the following every time I try to run xfs_check:
$ sudo xfs_check /dev/mapper/vg0-bigthree
xfs_check: /dev/mapper/vg0-bigthree contains a mounted and writable filesystem
fatal error -- couldn't initialize XFS library
Just to be thorough, I started by trying to run
$ sudo fsck.xfs /dev/mapper/vg0-bigthree
If you wish to check the consistency of an XFS filesystem or
repair a damaged filesystem, see xfs_check(8) and xfs_repair(8).
before turning to xfs_check.
Also, I can confirm that there is no occurrence in the output of mount
or in /etc/mtab
of the volume's device or mount point.
This is how I got around this on my system. I saw the same issues as you when trying to run xfs_check. Clearly the fs is un-mounted. It appears as though either autofs or nfs was still holding onto the filesystem and once they were stopped the check ran.
Try
strace -fF -o /tmp/debugfile sudo xfs_check /dev/mapper/vg0-bigthree
and thengrep open /tmp/debugfile.*
to see what actually happens behind the scenes before xfs_check decides to throw out that error.