How to Operate Your Phone when the Flash has Died

If you (like me) like to use your phones until they die of old age, you might experience the unfortunate moment when the internal flash "ROM" has levelled the wear to 100% all over the chip and further writes result in unpredictable behavior.

Unfortunately, I experienced that moment somewhere in the woods while using OSM maps to navigate a good way back home. (Obviously, I also had paper-based backup, but for the story's sake...; and anyway the paper map was crap compared to OSM).

Some thinking leads to the obvious conclusion that the phone does in fact have another flash chip in there... So, termux:

bash$ su
w5:/ dd if=/dev/block/mmcblk0p34 of=/mnt/media_rw/903F-1713/data.img bs=4k
w5:/ mount -o loop /mnt/media_rw/903F-1713/data.img /data

... and some application restarts later, everything relevant has obtained shiny new file descriptors on the looped-back device. Android userland has since declared the SD-card "corrupt" (so maybe it's not only the onboard flash which is a bit wonky), but so far (3 days) it's still holding together.

In case some of the writes have only managed to zero the pages (but no new data was written), it can apparently happen that some modem state gets corrupted. In any case, I also needed

w5:/ mkfs.ext2 /dev/block/platform/msm_sdcc.1/by-name/modemst1
w5:/ mkfs.ext2 /dev/block/platform/msm_sdcc.1/by-name/modemst2

to get the mobile phone network back.