So it came to pass, that Amanda did have a blonde moment and deleted all her threads in the SMS app by mistake. Yeah, "Delete all threads" probably shouldn't be quite so easy to invoke.
The phone's a ZTE Blade, with all its user data inconveniently stored on a YAFFS2 filesystem.
I have an old back up, but the SMS I need to recover are from since then. There are probably some on the SIM card, so I've ordered a SIM reader. I suspect that the twenty or so it holds are mostly network operator spam, anyway.
So, I curse my ineffectual backup plan and vow to back up SMS to GMail in future.
Meanwhile, I resolve to recover mmssms.db, or what's left of it.
First up, I connect adb and check the mounts, then attempt to copy the block to an image on the SD card:
dd if=/dev/block/mtdblock6 of=/sdcard/data.img
No such luck. I reason forcibly dismounting would be a bad idea, and probably won't work in any case.
So, I upload a statically linked copy of busybox to the SD card and use the conv=noerror option.
What I ended up with was a file that kept increasing in size until the SD card filled up.
What am I doing wrong? Does ClockworkMod take an image in the true sense or does it just back the files up and pack them into an image? Is there a YAFFS2 recovery program? (The two papers I've read make it seem feasible but I haven't seen even PoC code)
Any clues gratefully received/
Edit: The phone is rooted. Very rooted :)
Most of the messages found in mmssms.db-wal:
ls -al /data/data/com.android.providers.telephony/databases drwxrwx--x 1 radio radio 2048 Jul 17 20:16 . drwxr-xr-x 1 radio radio 2048 Oct 26 2011 .. -rw-rw---- 1 root root 60416 Jul 17 20:16 mmssms.db -rw-rw---- 1 radio radio 32768 Jul 17 16:18 mmssms.db-shm -rw-rw---- 1 radio radio 628832 Jun 30 19:23 mmssms.db-wal -rw-rw-rw- 1 root root 60416 Jul 17 20:16 mmssms.db.xxx -rw-rw---- 1 radio radio 132096 Jun 18 13:25 telephony.db -rw-rw---- 1 radio radio 32768 Jul 16 22:14 telephony.db-shm -rw-rw---- 1 radio radio 106928 Jul 16 22:14 telephony.db-wal
With any luck, SMS Backup & Restore will allow a merge.