Why won't xfs_check run?
Solution 1:
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.
[root@openfiler ~]# xfs_check /dev/backup2/backup2
xfs_check: /dev/backup2/backup2 contains a mounted and writable filesystem
fatal error -- couldn't initialize XFS library
[root@openfiler ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc2 35775912 804200 33125044 3% /
/dev/sdc1 101086 14410 81457 16% /boot
tmpfs 512440 0 512440 0% /dev/shm
[root@openfiler ~]# cat /etc/mtab
/dev/sdc2 / ext3 rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/sdc1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/rpc_pipefs rpc_pipefs rw 0 0
automount(pid2644) /misc autofs rw,fd=4,pgrp=2644,minproto=2,maxproto=4 0 0
automount(pid2681) /net autofs rw,fd=4,pgrp=2681,minproto=2,maxproto=4 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
[root@openfiler ~]# service autofs stop
Stopping automount: [ OK ]
[root@openfiler ~]# cat /etc/mtab
/dev/sdc2 / ext3 rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/sdc1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/rpc_pipefs rpc_pipefs rw 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
[root@openfiler ~]# service nfs stop
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS services: [ OK ]
[root@openfiler ~]# cat /etc/mtab
/dev/sdc2 / ext3 rw 0 0
/proc /proc proc rw 0 0
/sys /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/sdc1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/rpc_pipefs rpc_pipefs rw 0 0
nfsd /proc/fs/nfsd nfsd rw 0 0
[root@openfiler ~]# xfs_check /dev/backup2/backup2
Solution 2:
Try strace -fF -o /tmp/debugfile sudo xfs_check /dev/mapper/vg0-bigthree
and then grep open /tmp/debugfile.*
to see what actually happens behind the scenes before xfs_check decides to throw out that error.