文件系统错误修复实例(1)

》错误信息

[root@alex~]# grep error /var/log/messages

Apr 15 17:21:00 alex kernel: EXT2-fs error (device cciss/c0d0p3): ext2_lookup: deleted inode referenced: 23824100

ext2_lookup是ext2文件系统中处理路径查找的入口函数,参数dir表示父目录的inode结构,nd是指向一个上下文辅助结构的指针。

file:fs/ext2/namei.c
static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
{
struct inode * inode;
ino_t ino;
if (dentry->d_name.len > EXT2_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
 
ino = ext2_inode_by_name(dir, &dentry->d_name);
inode = NULL;
if (ino) {
inode = ext2_iget(dir->i_sb, ino);
if (IS_ERR(inode))
return ERR_CAST(inode);
}
return d_splice_alias(inode, dentry);
}

错误信息显示某个进程访问的inode已经被删除。这类大部分都可以通过文件系统修复工具fsck来修复。具体操作为:

(1)以root权限登陆系统;

(2)卸载出错分区;

(3)对出错分区执行fsck.ext2/3/4修复命令(e2fsck和fsck.ext2是完全一样的);

(4)重新挂载;

(5)完成;

》操作

以下面这条错误信息为便进行一次修复操作。

Apr 15 17:21:00 alex kernel: EXT2-fs error (device cciss/c0d0p3): ext2_lookup: deleted inode referenced: 23824100

设备/dev/cciss/c0d0p3挂载在/home分区,直接卸载貌似不行,显示文件系统正在被使用,所以先应该停掉占用该文件系统的进程。fuser工具可以帮我们解决这个问题,关于fuser的简单介绍在附录中。

[root@alex /]# umount /home/

umount: /home: device is busy

umount: /home: device is busy

使用fuser杀掉占用/home文件系统的所有进程,然后再umount。

[root@alex /]# /sbin/fuser -k /home/

[root@alex /]# umount /home

这时就可以用e2fsck来修复了,执行命令。

[root@alex /]# e2fsck /dev/cciss/c0d0p3

完了之后,重新mount就可以使用了。

[root@alex /]# mount /dev/cciss/c0d0p3 /home

》附录

fuser命令是用来显示所有正在使用着指定的file, file system 或者 sockets的进程的信息。它通常用于解决类似上文中卸载磁盘时出现的“resource busy”问题,有以下常用的一些选项。

-k 

kills all process accessing a file. For example fuser -k /path/to/your/filename kills all processes accessing this directory without confirmation. Use -i for confirmation

-i 

ask before killing (ignored without -k)

-v 

verbose.

-u 

append username

-a 

display all files

-n space

Select a different name space. The name spaces file (file names, the default), udp (local UDP ports), and tcp (local TCP ports) are  sup-ported.   For  ports,  either  the  port  number  or  the symbolic name can be specified. If there is no ambiguity, the shortcut notation name/space (e.g. name/proto) can be used.

-m 

name specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed to name/. to use any file system that might be mounted on that directory.

>

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值