Friday morning working on installing OpenWrt pivot overlay on an USB pendrive. I need to format the USB and as I was doing it quite so many times I wasn’t paying too much attention. Don’t do that at home 😉
The USB was recognized as
/dev/sdb1 on my laptop but on the router it was on
/dev/sda1. As you have probably already guessed my main laptop hardrive was
I didn’t notice I wasn’t in the router console (f….. tabs) and after having successfully formatted the USB I decided to make it zero:
# dd if=/dev/zero of=/dev/sda1
I continue working on the laptop but when in typed ‘ls’ nothing is shown and even I got
unknown command. Uppps… something is going wrong. I just realized I was formatting my hard drive in stead of the USB.
Advice (take it if you want): In case this happens to you, press Ctrl+C as soon as you can to minimize the overwritten and lost data.
Most of my work for the last few years was there, programs, repositories, configurations, … I thought I was not going to be able to recover anything. Luckyly I pressed Ctrl+C quite quickly and only 1Gb was set to zero. Not everything was lost 😉
So if you ever come to that, don’t panic. You can at least recover what was not overwritten with 0, and even part of that I think it can also be recovered.
Next I’m explaining how I did it. It is quite short and easy procedure.
Creating ROM Backup
Flash the recovery image
$ ./fastboot flash recovery recovery-clockwork-188.8.131.52-crespo.img sending 'recovery' (4040 KB)... OKAY [ 0.642s] writing 'recovery'... OKAY [ 0.540s] finished. total time: 1.187s
The ClockworkMod Recovery should now be installed on the Nexus S.