How can I see the progress of e2fsck in the terminal? Are there any pv like ways?

For example how can I see how far along this command is in progress:

e2fsck -f -y -v /dev/sdb1
  • 1
    From the man page it looks like -C offers some kind of progress indicator. Does that not work for you? – Faheem Mitha Jun 17 '11 at 7:49

From man e2fsck:

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

Note particularly the line I bolded and try e2fsck -C 0. Apparently you can even enable the progress bar output after you run the program by sending the process the right signal!

pkill -SIGUSR1 e2fsck
  • Note: Edited to include information on getting progress on an already started app. It's amazing what you can learn by actually reading man pages! – Caleb Jun 17 '11 at 15:53
  • I really, really don't understand how this isn't the default, or e2fsck doesn't have a proper --progress option. – Fake Name Dec 1 '13 at 11:54
  • @FakeName This is how the UNIX philosophy works. Each tool does one thing, does it well, and leaves the other aspects of the system alone. The e2fsck tool is a system level utility that is meant to be automatically called by other tools when needed. It is designed to be easily wrapped up as a utility inside another toolkit. Hence it's options are tailored to being parsed from a file descriptor. If you want to draw a progress bar around it, draw a progress bar from the data. Meanwhile it has an option for outputing status data that can be even turned on and off after launch! – Caleb Dec 1 '13 at 12:58
  • I'm well-aware of the unix philosophy. I'm also aware of how the documentation of the existing options is rather lacking (this answer actually comes before the man-page for "e2fsck progress" on google. I'd feel better about it if any of the other tools actually used the output. GParted certainly doesn't, at least from my recent use of it. – Fake Name Dec 1 '13 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.