Mounting / Fixing Raspbian SD Card from Raspberry Pi
Thu, Mar 5, 2015 in post General Raspberry Pi Tips and Tricks e2fsck fsck partition raspbian resize2fs sd card
Shut down my Pi today and thought to make a copy of files in its SD card. This is what mount /dev/sdf2 /mnt
had to say:
mount: wrong fs type, bad option, bad superblock on /dev/sdf2, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
Great. After trying parted
and fsck
, it became apparent that for some reason, the root partition is marked as being 1 block longer than the physical card. Must be a bug with Raspbian partition expansion or something.
Thankfully, I found this gold nugget which suggested using resize2fs
to fix it. Turns out I had to run e2fsck first (and say “y” a couple of times):
sudo e2fsck /dev/sdf2
sudo resize2fs /dev/sdf2
mount /dev/sdf2 /mnt
Voilá! Fully functioning filesystem again.