Fixing a hard disk

Just recently we installed a new sata disk at work. When we did the other one that we installed at the start of the year stopped being visible in Windows. It turned into a ‘dynamic’ disk according to the disk manager.

A search of the interweb came up with all sorts of fun suggestions like reformatting. There was one article that suggested that it was simply the type of the partition that got changed in the master boot record. It said that you just needed to change the byte back to it’s original value and everything would be peachy.

Rather than look for the utils that it suggested I just fired up a box with the Ubuntu boot/install CD and used DD. From memory the command dd if=/dev/sda of=bootsect.bin bs=512 count=1 retrieved the boot sector.

Note that the exact hard disk device you specify is very important. Typically you have a device for each partition of the hard disk, normally the partitions have a number and the master boot record can be accessed by the device without the 0. In my case there was /dev/sda, /dev/sda0 and /dev/sda1 available. If you were to perform the same dd command against those other partitions you would see the individual partitions boot sector rather than the master boot record.

I then transferred the MBR off using a USB flash disk since I hadn’t plugged a network cable in and fired it up in ultraedit. The type of the partition matched exactly what the article suggested it would be so I followed the instructions, changed it and copied it back. When I fired up Windows again everything was back to normal.

I had a similar thing happen about 5 years ago where the type got changed and I still haven’t figured out what causes it. Does anybody know? Back then I didn’t know Linux so well and I created a util to run from a DOS boot disk using assembler. The standard Int 13 calls I grew up with didn’t work for the big hard disks (all 10Gb) and I had to use some extended functions but I got the same basic effect.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s