Isn't ext4 a journaling file system?
I'm running Raspbian.
testdisk recovered the partition, but the file system wasn't recoverable.
I had to use dd to restore a copy of the entire sd card.
Needless to say I lost several weeks of tinkering.
Is there a way to have a continuous backup of the root fs to a network location?
UPDATE
Today I started to have serious issues performing apt-get
commands trying to re-install packages that got "removed" when I restored my Pi from an old backup. Checking the syslog I noticed the that the kernel was logging write timeout errors to my SD card.
Then grepping all the syslogs that I had available I can see that these write timeout errors have been happening silently for some time.
My guess is that I have been silently having writes to disk failing for some time and overtime this finally lead to my loss of the entire file system.
/var/log/syslog.5.gz:Oct 11 16:49:55 raspberrypi kernel: [ 1984.145023] mmc0: final write to SD card still running
/var/log/syslog.5.gz:Oct 11 16:50:05 raspberrypi kernel: [ 1994.147878] mmc0: Timeout waiting for hardware interrupt - cmd12.
/var/log/syslog.5.gz:Oct 11 16:50:05 raspberrypi kernel: [ 1994.149077] mmcblk0: error -110 sending stop command, original cmd
response 0x900, card status 0x900