你如何让 e2fsck 显示进度信息?

Tim*_*ell 49 linux ext3 fsck

我在一个非常大的(1TB+)ext3 磁盘上运行 e2fsk

e2fsck -v /dev/sda1
Run Code Online (Sandbox Code Playgroud)

来自使用 PXE 启动的 RIPLinux。

我得到

e2fsck 1.41.6 (30-May-2009)
/dev/sda1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Run Code Online (Sandbox Code Playgroud)

然后是很长的停顿……

我如何了解活动?

理想情况下,完成项目的计数与总数和某种 ETA。

War*_*ner 78

-C标志将显示一个进度条。性能差异取决于 fsck 的调用方式。

非常酷,如果e2fsck已经在运行,你可以发送一个USR1信号让它开始显示进度条。 USR2停止。例子:

killall -USR1 e2fsck

来自 FSCK(8):

   -C     Display completion/progress bars for those filesys-
          tems  checkers (currently only for ext2) which sup-
          port them.   Fsck will manage the filesystem check-
          ers  so  that  only  one  of  them  will  display a
          progress bar at a time.
Run Code Online (Sandbox Code Playgroud)

来自 E2FSCK(8):

   -C fd  This  option  causes  e2fsck  to  write  completion
          information  to  the  specified  file descriptor so
          that the progress of the filesystem  check  can  be
          monitored.   This  option is typically used by pro-
          grams  which  are  running  e2fsck.   If  the  file
          descriptor specified is 0, e2fsck will print a com-
          pletion bar as it goes about  its  business.   This
          requires  that e2fsck is running on a video console
          or terminal.
Run Code Online (Sandbox Code Playgroud)

  • 嗯...今天我学到了(从 fsck 获取输出的 USR 信号)。感谢您的知识,@Warner。 (4认同)
  • 看起来您的手册页适用于不同版本的 e2fsck。我会从我的版本中发布一个答案,但它非常接近并且您的答案足以让我阅读手册页的正确部分。非常感谢! (2认同)
  • -USR1 标志是无价的。我在这里创建了一个帐户,以便我可以投票。 (2认同)

Tim*_*ell 21

来自 1.41 版的手册页

   -C fd  This option causes e2fsck to write completion information to the specified file descriptor so that the progress of the
          filesystem  check  can be monitored.  This option is typically used by programs which are running e2fsck.  If the file
          descriptor number is negative, then absolute value of the file descriptor will be used, and the  progress  information
          will  be  suppressed  initially.  It can later be enabled by sending the e2fsck process a SIGUSR1 signal.  If the file
          descriptor specified is 0, e2fsck will print a completion bar as it goes  about  its  business.   This  requires  that
          e2fsck is running on a video console or terminal.
Run Code Online (Sandbox Code Playgroud)

所以我想答案是

e2fsck -C 0 /dev/sda1
Run Code Online (Sandbox Code Playgroud)


小智 6

ps-ef | grep fsck

  5079  5007 47 00:55 pts/1    00:08:25 /sbin/fsck.ext3 -yv /dev/hda2
Run Code Online (Sandbox Code Playgroud)

与进程 ID,

杀-USR1 5079

  • 此答案与已接受的答案相同,只是它没有提供上下文信息来帮助用户理解“为什么”他们遵循您的指示。对于未来,请注意,我们更喜欢能够解释解决方案的“如何”和“为什么”的答案(“授人以渔”原则)。 (3认同)