Repairing USB drives
by
, 09-01-2010 at 08:53 PM (231 Views)
I came up with a solution to a problem I was having, a hack that saved me about $60. I'm quite proud of it, even though I know it wasn't the most ingenious idea. : P
The problem I had was that, in the process of trying to install Debian according to the instructions in the installation manual, I had fu˘ked up two USB drives. After writing a filesystem and then data to an unpartitioned stick, I found that the BIOS no longer detected it, and it would not show up in the boot menu, making it impossible for me to boot up to do the install. Even after I erased all the data, the drives still would not show up. They appeared to be permanently sabotaged.
There are three things that can be on a storage device: partitions, formatting, and data. The presence or absence of some of these may have caused the BIOS to barf. There are eight possible combinations. I tested each of them:
So apparently, having something written to the device but not to the partition causes it to be unreadable. This was probably why I got an error when I tried to write the filesystem to the device using mkfs, and had to use the -I option.Code:Partitioned Formatted Data Detected Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes Yes No No Yes No No No Yes No Yes No No No Yes Yes No No No Yes -*
I realized that what I had to do was delete the filesystem itself. The problem was that there don't seem to be any documented methods of deleting a filesystem other than deleting the partition it's on. I searched for answers on Google and all I found was stuff about deleting individual files, and one forum thread that was about deleting a filesystem on a partition.
Since there was no command for unformatting a drive, I had to completely overwrite it, essentially by turning all of the bits into zeros:
It took a long time to copy, but when I rebooted it, I found that the USB drive showed up in the boot menu. I was able to restore the stick that I had sacrificed to try to diagnose the problem, and to restore the other two as well.Code:dd if=/dev/zero of=/dev/sdb
I think I am getting better at computers in general. My technical expertise is rapidly improving with all that I am doing. I was actually able to fix a problem that seemed unfixable using the scientific method (hypothesizing, testing all possible solutions, and observing). Now I just need to find a way to install Debian.










