First, if it happen to you, your disk is dieing, change it. But if you need to fix the problem to do a backup, or simply want to fix the problem for now and tag the bad block so the disk is "safe" for a few more months, it worth trying.

I just had the problem, /usr/portage was broken and I could not use portage. It's quite bad, I will replace the disk soon, but for now, I just wanted it to work again, I needed portage. So, what could I do?

After a little googling, I heard about debugfs for some other unrelated purpose, but I tried it. Bingo! This tool come with Linux and offer a wide range of tools to fix file system. See it as a manual fsck.

everything went back to a working state. A few S.M.A.R.T command later, the disk is now safe to use again. It's quite cool to know when you need to fix thing now. A nice thing to know for every plumber/sysadmin out there.

-THIS IS A TEMPORARY SOLUTION- but it still cool to have

I hope it can save your day or help you laugh at in the face of the Murphy law in a critical moment of your career

Update: As "planned" the disk became unusable a few days later. To backup your failed disk offline, use

Code:

cp -a /mnt/old/* /mnt/new/

This will properly copy everything and keep the symlink. Dont use DD as you will probably produce a corrupted file system.