Linux – How to get e2fsck to show progress information

ext3fscklinux

I'm running e2fsk on a very large (1TB+) ext3 disk with

e2fsck -v /dev/sda1

from RIPLinux booted with PXE.

I get

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

and then a very long pause…

How do I get some idea of activity?

Ideally a count of completed items vs total and some kind of ETA.

Best Answer

The -C flag will display a progress bar. Performance differences depending on how fsck is called.

And very cool, if e2fsck is already running, you can send a USR1 signal for it to start displaying a progress bar. USR2 to stop. Example:

killall -USR1 e2fsck

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

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