3

I had some drive errors so I ran e2fsck -cckty to find bad blocks on a 2TB drive. It found some bad blocks at the beginning, but hasn't found any in a day and a half. e2fsck has been running for 40 hours and is 53% done. If I Ctrl-C it, will it update the bad blocks information in the filesystem to reflect the bad blocks it found at the beginning?

  • I'd guess no. But what type of drive is this that doesn't manage its own bad block list? – derobert Apr 23 '14 at 17:13
4

I see the below answer from here.

The filesystem check on boot is usually read-only until it finds a problem then it will prompt you before making any changes so it is probably safe to intereupt.

But is is quite possible (and not uncommon for servers that need to come back up after a power-out) for it to be set to auto-fix, so unless you know for sure that your system is not configured this way let it run to completion for safety.

Most fsck programs are written in such a way that any changes that make are as atomic as possible and they will clean-up (completing or rolling back any current change) before responding to a TERM or INT signal (SIGINT is what is sent to the active process when ctrl+c is pressed) so even an actively writing fsck should be safe to interrupt, but I woudl not recommend taking the risk - better safe than sorry!

1

As far as I can see, no. If I understand the source correctly, e2fsck runs badblocks, reads it's output and then updates the bad block inode in one run after badblocks finished. If you Ctrl-C, this path should not be reached.

What could work is killing the spawned badblocks process explicitly since e2fsck does not seem to care for the exit code, so it would take what it put out so far and process it, but no guarantee that this would work.

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.