为什么 xfs_check 无法运行?

为什么 xfs_check 无法运行?

我正在运行完全更新的 Ubuntu 9.04“Jaunty”i686 服务器。我在名为 的 LVM 组中有单个 XFS 卷/dev/mapper/vg0-bigthree

如果我启动到单用户模式并确保卷已被卸载,每次我尝试运行 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

为了彻底起见,我首先尝试运行

$ 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).

在转向 xfs_check 之前。

此外,我可以确认在卷的设备或挂载点的输出mount中没有出现任何内容。/etc/mtab

答案1

这是我在系统上解决这个问题的方法。当我尝试运行 xfs_check 时,我看到了与您相同的问题。显然,fs 未挂载。看起来好像 autofs 或 nfs 仍在持有文件系统,一旦它们停止,检查就会运行。

[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

答案2

尝试strace -fF -o /tmp/debugfile sudo xfs_check /dev/mapper/vg0-bigthree然后grep open /tmp/debugfile.*查看在 xfs_check 决定抛出该错误之前幕后实际发生了什么。

相关内容