如何在允许试验系统时间更改的同时避免“手动运行 fsck”消息?

me_*_*and 18 boot rhel date fsck

我正在使用一个系统,我们希望允许用户根据需要随意调整日期和时间,并且可以随意重新启动。这很好,除了一件事:如果向后跳的时间很长,重新启动时会出现以下错误:

Checking filesystems
IMAGE2: Superblock last mount time (Tue Mar  1 17:32:48 2011,
        now = Thu Feb 24 17:34:29 2011) is in the future.

IMAGE2: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)

*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** when you leave the shell.
Run Code Online (Sandbox Code Playgroud)

...然后引导挂起等待用户控制台输入,即使获得控制台访问权限,也需要 root 密码才能继续。

这显然不太理想。有没有办法跳过检查或强制检查在重新启动时自动发生?

谷歌只提供了需要手动运行 fsck 的帮助,如果/当它被击中时,这不是我所追求的。设置时间后手动运行 fsck 不起作用,因为此时文件系统仍处于挂载状态,并且完全禁用 fsck 不太理想。

我正在使用红帽 6。

更新:我目前使用的解决方案是破解 fstab 以禁用重新启动时的 fsck 检查。我曾尝试使用 编辑磁盘上的最后安装时间debugfs,这对于 ext3 驱动器工作正常,但在 ext4 上似乎不一致。

mat*_*tdm 15

我打算建议 hackinge2fsck禁用对上次安装时间或将来上次写入时间的特定检查。这些在problem.c / problem.h中定义,并在super.c 中使用。但在查看时,我发现 E2fsprogs 1.41.10 添加了一个新选项,/etc/e2fsck.conf称为broken_system_clock。这似乎正是您所需要的,而且由于您使用的是 Red Hat Enterprise Linux 6,因此您应该拥有 1.41.12,其中包含此选项。从手册页:

   broken_system_clock
          The e2fsck(8) program has some hueristics that assume  that  the
          system clock is correct.  In addition, many system programs make
          similar assumptions.  For example, the UUID library  depends  on
          time  not going backwards in order for it to be able to make its
          guarantees about issuing universally unique ID’s.  Systems  with
          broken  system clocks, are well, broken.  However, broken system
          clocks, particularly in embedded systems, do exist.  E2fsck will
          attempt  to  use  hueristics to determine if the time can no tbe
          trusted; and to skip time-based checks if this is true.  If this
          boolean  is set to true, then e2fsck will always assume that the
          system clock can not be trusted.
Run Code Online (Sandbox Code Playgroud)

是的,手册页不能拼写“启发式”。哎呀。但大概代码无论如何都可以工作。:)