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.
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
Using Disk Utility on Mac I had to reinstall/reformat the card to make it writable again.
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.
sudo dd if=backup.img of=/dev/disk4s1 bs=1m
Install fsck/resize2fs
brew install e2fsprogs
Fix the partition's size
sudo fsck -f /dev/disk4s1 sudo resize2fs /dev/disk4s1
Boot your Pi and 🤞!