Skip to content

Instantly share code, notes, and snippets.

Last active Sep 13, 2020
What would you like to do?
Recover OSMC installation on SD card after power failure

After a power failure my Rasberry Pi running OSMC would not boot anymore. SD Card do not seem to appreciate power failures and the FS is often left corrupted.

When booting the Pi, no bootable filesystem could be found.

Using a Mac I was able to recover it.

Backup the partition with data

The SD card holds 2 partitions one to bootstrap OSMC and one with the system. On my Mac the SD card showed under /dev/disk4.

We can copy the partition to a file using

sudo dd if=/dev/disk4s1 of=backup.img bs=1m

Recover the SD card

Using Disk Utility on Mac I had to reinstall/reformat the card to make it writable again.

Reinstall OSMC on the card

Done using the standard installer (although I had issues with that and ended up dd the image file directly).


On first boot it will bootstrap the system and create the second partition.

Copy back your backup to the second partition

sudo dd if=backup.img of=/dev/disk4s1 bs=1m

Fix the FS

Install fsck/resize2fs

brew install e2fsprogs

Fix the partition's size

sudo fsck -f /dev/disk4s1 sudo resize2fs /dev/disk4s1

Boot your Pi and 🤞!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment