首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安全地禁用只读ext3文件系统上的引导fsck?

安全地禁用只读ext3文件系统上的引导fsck?
EN

Unix & Linux用户
提问于 2013-10-17 16:23:13
回答 3查看 2.1K关注 0票数 2

我有一个大型的,经常阅读的,ext3文件系统挂载只读的系统,通常总是硬功率循环大约2-3次一天。

由于设备通常是通过切断电源而关闭的,fsck在该文件系统上运行,但是对于这个应用程序来说,快速启动时间是非常重要的(对于第二个)。

我可以在fstab中禁用对文件系统的启动时间检查,但我的问题是,这样做安全吗?假设文件系统是只读挂载,但从未正确卸载,如果禁用启动时间检查,是否存在长期累积文件系统损坏的风险?

EN

回答 3

Unix & Linux用户

回答已采纳

发布于 2013-10-17 16:48:45

mount手册中,

代码语言:javascript
复制
   -r, --read-only
          Mount the filesystem read-only. A synonym is -o ro.

          Note  that,  depending  on the filesystem type, state and kernel
          behavior, the system may still write to the device. For example,
          Ext3 or ext4 will replay its journal if the filesystem is dirty.
          To prevent this kind of write access, you may want to mount ext3
          or  ext4  filesystem  with  "ro,noload" mount options or set the
          block device to read-only mode, see command blockdev(8).

如果ro,noload应该被证明是不够的,我不知道如何设置一个只包含fstab条目的只读设备;在您的文件系统挂载之前,您可能需要调用blockdev --setro或通过其他方式创建只读循环设备(losetup --read-only)。

如果你使它真正的只读,它甚至不会知道它是安装的。因此,没有挂载计数更新和强制fsck,特别是不可能损坏,只要没有任何写入设备.

票数 4
EN

Unix & Linux用户

发布于 2013-10-17 16:27:38

来自tune2fs手册:

代码语言:javascript
复制
   -c max-mount-counts
          Adjust the number of mounts after which the filesystem will be checked by e2fsck(8).  If max-mount-counts is 0 or -1, the number
          of times the filesystem is mounted will be disregarded by e2fsck(8) and the kernel.

          Staggering  the mount-counts at which filesystems are forcibly checked will avoid all filesystems being checked at one time when
          using journaled filesystems.

          You should strongly consider the consequences of disabling mount-count-dependent checking entirely.  Bad  disk  drives,  cables,
          memory, and kernel bugs could all corrupt a filesystem without marking the filesystem dirty or in error.  If you are using jour-
          naling on your filesystem, your filesystem will never be marked dirty, so it will not normally be checked.  A  filesystem  error
          detected  by the kernel will still force an fsck on the next reboot, but it may already be too late to prevent data loss at that
          point.

          See also the -i option for time-dependent checking.

以及:

代码语言:javascript
复制
   -i  interval-between-checks[d|m|w]
          Adjust the maximal time between two filesystem checks.  No postfix or d result in days, m in months, and w in weeks.  A value of
          zero will disable the time-dependent checking.

          It  is  strongly recommended that either -c (mount-count-dependent) or -i (time-dependent) checking be enabled to force periodic
          full e2fsck(8) checking of the filesystem.  Failure to do so may lead to filesystem corruption due to bad disks, cables, memory,
          or kernel bugs to go unnoticed until they cause data loss or corruption.

因此,您可以将两者都设置为零,这将禁用自动fsck's (假设您确实想这样做)。

票数 0
EN

Unix & Linux用户

发布于 2013-10-17 17:08:40

出于历史和上下文的原因,留下我的另一个答案,但我看到了你的实际问题:是的,你还是想做一个fsck。所有磁盘都有一个有限的生命周期,fsck将把坏扇区分配给一个“坏块”inode/list,这样就不会有新的文件使用它们。

“只读”(以及执行noload内容,frotschutz正在讨论)有助于防止服务中断导致的一致性问题,但您仍然需要对硬件进行解释。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/96506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档