![如何让 e2fsck 显示进度信息?](https://linux22.com/image/507549/%E5%A6%82%E4%BD%95%E8%AE%A9%20e2fsck%20%E6%98%BE%E7%A4%BA%E8%BF%9B%E5%BA%A6%E4%BF%A1%E6%81%AF%EF%BC%9F.png)
我在一个非常大的(1TB+)ext3 磁盘上运行 e2fsk
e2fsck -v /dev/sda1
从使用 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
然后是很长的停顿……
我如何了解一些活动?
理想情况下,已完成项目的数量与总数以及某种预计到达时间 (ETA) 的数量。
答案1
该-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.
来自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.
答案2
来自 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.
所以我猜答案是
e2fsck -C 0 /dev/sda1
答案3
ps -ef | grep fsck
5079 5007 47 00:55 pts/1 00:08:25 /sbin/fsck.ext3 -yv /dev/hda2
使用进程 ID,
杀死-USR1 5079
答案4
为什么?
BSD 系统及其后代都有 SIGINFO 信号。它使程序将其当前状态输出到控制台。许多基本的 BSD 工具都知道并支持此信号。您可以使用 Ctrl+T 将此信号发送到当前进程。
SysV 系统没有这样的信号,也没有 Ctrl+T。一些 Linux 工具支持 SIGUSR1。我只知道“dd”和“e2fsck”,但可能还有更多。没有 Ctrl+? 快捷方式来发送它,所以你必须手动使用“kill -USR1”来处理进程的 pid。
大多数其他程序对 SIGUSR1 的反应与对 SIGTERM(退出)的反应相同,因此除非您知道它受支持,否则不要发送此信号。