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.
As of my later post, you get the Voyage SDK or default distribution installed on a hard disk, compact flash, etc. However, many times is it required to perform some customizations. These can be done once the system is installed and then creating an image of the whole system using
dd for instance. But you might want to customize it and have an iso image created from scratch and without having to deal with a real system.
This tutorial is a mixture of both approaches, as at the beginning it is explained who to compile and install new applications or kernel, to end with the building of a Live CD, a tar.bz2 distro, etc. using Debian Live.