When I was overclocking my pi using an usb hard drive as rootfs, I got more than once some filesystem corruption, after googling I found a blog post of JustChecking’s explaining how to use the fsck.ext4 command.
fsck.ext4 -cDfty -C 0 /dev/sd**
- -c – check for bad sectors
- -D – optimize directories if possible
- -f – force check, even if filesystem seems clean
- -t – print timing stats (use -tt for more)
- -y – assume answer “yes” to all questions (such as, “do you want to continue”)
- -C 0 – print progress info to stdout
- /dev/sd** – the partition to check, e.g. /dev/sda1 for first partition (1) on first hard disk (a), etc.
- First I created a bootable usb key with Linux Mint on it, once booted, I plugged my hard drive and waited for Linux to pick it up.
- When the device show up on the desktop, I check the mount point using the command
- Then I take the “id” of the device and unmount it. Finally, I run the above command on the filesystem and let it repair/optimize it.
Leave a Reply