免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5751 | 回复: 15
打印 上一主题 下一主题

e2fsck [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-10-26 17:24 |只看该作者 |倒序浏览
下面是ulk3中的一段话
updates to filesystem blocks might be kept in dynamic memory for long period of time before being flushed to disk. A dramatic event such as a power-down failure or a system crash might thus leave the filesystem in an inconsistent state. To overcome this problem, each traditional Unix filesystem is checked before being mounted; if it has not been properly unmounted, then a specific program executes an exhaustive, time-consuming check and fixes all the filesystem's data structures on disk.

For instance, the Ext2 filesystem status is stored in the s_mount_state field of the superblock on disk. The e2fsck utility program is invoked by the boot script to check the value stored in this field; if it is not equal to EXT2_VALID_FS, the filesystem was not properly unmounted, and therefore e2fsck starts checking all disk data structures of the filesystem.

我的问题是,一次意外的断电能使s_mount_state的值变为EXT2_ERROR_FS吗?如果可以,具体的情景是怎样的呢

论坛徽章:
0
2 [报告]
发表于 2007-10-26 20:39 |只看该作者
再问两个问题
(1) 为啥不能对已加载的文件系统运行e2fsck
(2)ext3文件系统中,一个块组(block group)就是一个柱面 (cylinder)吗
请大家指点,谢谢

论坛徽章:
0
3 [报告]
发表于 2007-10-26 22:50 |只看该作者
》我的问题是,一次意外的断电能使s_mount_state的值变为EXT2_ERROR_FS吗?如果可以,具体的情景是怎样的呢

不会, EXT2_ERROR_FS 标记只有在文件系统遇到无法处理的错误时才会被设置。

EXT3在mount后会清除超级块中的EXT2_VALID_FS标记,umount时会重新设置上,所以掉电后的文件系统的的EXT2_VALID_FS标记是清除了的。


》(1) 为啥不能对已加载的文件系统运行e2fsck
内核会改写磁盘上的数据, e2fsck读到的数据会不一致。

》(2)ext3文件系统中,一个块组(block group)就是一个柱面 (cylinder)吗
不是

[ 本帖最后由 daemeon 于 2007-10-26 22:53 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2007-10-26 23:07 |只看该作者
原帖由 daemeon 于 2007-10-26 22:50 发表
》我的问题是,一次意外的断电能使s_mount_state的值变为EXT2_ERROR_FS吗?如果可以,具体的情景是怎样的呢

不会, EXT2_ERROR_FS 标记只有在文件系统遇到无法处理的错误时才会被设置。

EXT3在mount后会清 ...

对文件系统不了解,问句题外话,系统在什么错误下会编程read-only呢?

论坛徽章:
0
5 [报告]
发表于 2007-10-26 23:14 |只看该作者

回复 #4 zx_wing 的帖子

EXT3超级块里有设置发生错误后的行为(continue, remount ro, panic)

see ext3_handle_error for more info.

[ 本帖最后由 daemeon 于 2007-10-26 23:16 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2007-10-26 23:21 |只看该作者

回复 #5 daemeon 的帖子

好,了解一下再来请教
我在2.6中没找到ext3_handle_error这个函数呢

[ 本帖最后由 zx_wing 于 2007-10-26 23:22 编辑 ]

论坛徽章:
0
7 [报告]
发表于 2007-10-26 23:25 |只看该作者

回复 #6 zx_wing 的帖子

/linux-2.6.xx/fs/ext3/super.c里

论坛徽章:
0
8 [报告]
发表于 2007-10-27 21:49 |只看该作者
原帖由 daemeon 于 2007-10-26 22:50 发表
EXT3在mount后会清除超级块中的EXT2_VALID_FS标记,umount时会重新设置上,所以掉电后的文件系统的的EXT2_VALID_FS标记是清除了的。

多谢。
我看了下2.6.10版do_mount > do_new_mount > do_kern_mount > ext3_get_sb > get_sb_bdev > ext3_fill_super ,并未看到有清除超级块中的EXT2_VALID_FS标记啊?请问这个标记具体在哪里清除的呢?谢谢

论坛徽章:
0
9 [报告]
发表于 2007-10-27 23:24 |只看该作者
不好意思, 现在EXT3/4在mount时不会清除EXT3/4_VALID_FS了。(ext3/4_setup_super里有段代码被注释掉了)

只有EXT2才在mount时清除EXT2_VALID_FS标记,清除操作在ext2_write_super中。

[ 本帖最后由 daemeon 于 2007-10-28 08:30 编辑 ]

论坛徽章:
0
10 [报告]
发表于 2007-10-28 12:43 |只看该作者
>>只有EXT2才在mount时清除EXT2_VALID_FS标记,清除操作在ext2_write_super中。

谢谢。不过ext2_write_super是在umount时调用的啊,路径如下
sys_umount > do _umount  > fsync_dev > sync_supers > ext2_write_super,在mount时并未调用ext2_write_super啊。

我看的是2.4.0版的ext2
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP