15

During boot my laptop says:

fsck died with status code 4

The man page tells me:

The exit code returned by fsck is the sum of the following conditions:

[..]

4 - File system errors left uncorrected

When I try to repair the errors as root, fsck says that my disk is clean:

$ fsck /dev/sda1
/dev/sda1, clean [and some things about available blocks]

How can I repair my disk?

OrangeTux
  • 1,053
  • 2
  • 16
  • 26
  • 1
    Did you try the `-y` option? From `fsck` manual: ` -y For some filesystem-specific checkers, the -y option will cause the fs-specific fsck to always attempt to fix any detected filesystem corruption automatically. Some- times an expert may be able to do better driving the fsck manually. Note that not all filesystem-specific checkers implement this option. In particular fsck.minix(8) and fsck.cramfs(8) does not support the -y option as of this writing.` – Ketan Maheshwari Jan 04 '14 at 20:22
  • (I assume `fkck` is a typo). Possibly you have another filesystem—are you sure you only have `/dev/sda1`? Check `/etc/fstab`. – derobert Jan 04 '14 at 21:33
  • @Ketan Unfortunately the `-y` flag does solve my problem. @derobert I ran `fsck` with each of my partitions that show up running `fstab`. – OrangeTux Jan 06 '14 at 08:52
  • @Ketan. My system runs again. Your solution solved, although I didn't mentioned it the first time. `fsck -y /dev/sda1` returned the same output as `fsck /dev/sda1`, so I thought it didn't help. But it did! Please write it down in an answer and I'll mark as accepted answer. – OrangeTux Jan 06 '14 at 08:57

2 Answers2

13

Try the -y option.

From fsck manual:

-y For some filesystem-specific checkers, the -y option will cause the fs-specific fsck to always attempt to fix any detected filesystem corruption automatically. Some- times an expert may be able to do better driving the fsck manually. Note that not all filesystem-specific checkers implement this option. In particular fsck.minix(8) and fsck.cramfs(8) does not support the -y option as of this writing.

Ketan Maheshwari
  • 9,054
  • 6
  • 40
  • 53
5

Sometimes fsck shows that a filesystem has no errors, but in reality it has. I had a similar issue once, and if you want to check that filesystem, you have to use force. I'm not sure what type of a filesystem you're using, but let's assume it's ext4:

Emergency help:
 -p                   Automatic repair (no questions)
 -n                   Make no changes to the filesystem
 -y                   Assume "yes" to all questions
 -c                   Check for bad blocks and add them to the badblock list
 -f                   Force checking even if filesystem is marked clean
 -v                   Be verbose
 -b superblock        Use alternative superblock
 -B blocksize         Force blocksize when looking for superblock
 -j external_journal  Set location of the external journal
 -l bad_blocks_file   Add to badblocks list
 -L bad_blocks_file   Set badblocks list

So, the line you need is:

# fsck.ext4 -pvf /dev/sda1
Mikhail Morfikov
  • 10,309
  • 19
  • 69
  • 104