How to recover a broken userdata.img? My userdata.img probably became partially corrupt because I created it with cat while the phone was running, instead of in recovery mode :-(. Due to this, when I flash it, the phone doesn't boot and logs several messages related to not finding things on /data over and over, since it couldn't mount /data.

I can put back an older userdata.img just fine and boot the phone, so my methodology works. I'd guess the new userdata.img isn't entirely rubbish as a hex editor shows data.

Attempts to explore (loop-mount) or unpack (unyaffs) on my laptop or on the Android phone itself have failed without much explanations, for the new image as well as for the (known-good) old image. Notably, running the unyaffs2 coming with the latest yaffs2utils tells me it wants to unpack 147 objects but nothing ever shows up.

How can I recover?
It's impossible, because FS has huge corruptions at different places. You can to use file repare utilities to try repare some data, but mostly it's broken by write to FS at the same moment, as dump process.