Linux

你如何讓 e2fsck 顯示進度資訊?

  • February 1, 2018

我在一個非常大 (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。

-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.

引用自:https://serverfault.com/questions/118791