Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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
add comment

1 Answer 1

up vote 8 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
add comment

Your Answer

 
discard

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.