Raspberry Pi SD card corruption repair

This morning my Espresso machine wouldn’t boot up, which was a bit of a shock. Fortunately the Minipresso was nearby as a backup.

It turned out that the SD card in my machine was corrupted. I pulled the SD card from the Pi and inserted it into a PC running Ubuntu Linux. It appears as several partitions, and the main file-system partition showed up at: /dev/mmcblk0p2

To fix the file-system, I used fsck as follows:

sudo fsck /dev/mmcblk0p2

I had to do that twice, then ejected it and put it back in the Pi. The Pi did another fsck and fixed some issues, and fortunately it rebooted OK. This time I was lucky I guess…

There is a much better explanation here!