Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running badblocks to check for bad segments on an external drive, and it's been about an hour and it has not yet finished. Now, I need to go and consider cancelling. Is this somehow risky? Should I avoid this?

Clearly, I will need to start again from scratch; I just want to know if this is somehow risky to abort midway.

share|improve this question
up vote 15 down vote accepted

From examining the source code, I find that:

If you didn't specify -n or -w, badblocks doesn't write to the disk at all, so you're safe interrupting it.

If you specified -w, badblocks has already overwritten the filesystem, so it's much too late to worry about interrupting the process.

If you specified -n, badblocks uses a signal handler to prevent the program from exiting with the disk in an inconsistent state, so it is safe to press ctrl-c.

share|improve this answer
Can there be an inconsistent state if there is no filesystem on the device? I assume that in write mode badblocks would have damaged all filesystem metadata structures already, so is there still room for inconsistency? – phunehehe Jul 26 '12 at 6:44
@phunehehe: There may be non-overwritten blocks on the device; but given that badblocks will start at the beginning of the disk, it's a moot point, as there won't be any partition table, thus technically making the disk "unformatted". (An unformatted disk is not required to be filled with zeroes - the content is undefined) – Piskvor Jul 26 '12 at 8:38
But I supposed that means there is no risk of inconsistency? Because everything is basically gone already. – phunehehe Jul 26 '12 at 9:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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