HI,

OK, for the archive of may be for an other unlucky sole that may be loosing sleep over this like I did for the last two days.

I know it's not an OpenBSD specific subject, but never the less countless google research, tests and some support emails that kept me going deserved an archive results for this.

If for no one else then myself, I know I will find it in the future if I need this again.

Plus something tells me that Nick most likely would be interested to know the outcome! (;>

Many thanks Nick for giving me hope and for a few other guys that send me some isolate support emails along the way.

Now 30+ some hours later it's fix.

Real simple solution as usual, but HELL to get there!

What was very helpful as a start what this details here:

http://blog.csdn.net/hotsolaris/archive/2008/12/23/3589039.aspx

This show that the same partition is available in to places and the accident messed up the first (master) one.

The issue was to get the backup to restore the main one.

All the refit info didn't help, now the efi, witch I knew nothing about two days ago, nor about refit either.

But the trick is to force mac and refit indirectly to see a dummy MBR/GPT record at the start of the disk on the first LBA1 and then see that it is not according to the backup one, but accept as valid GPT/MBR to force the update and creation of a new one for valid backup data.

So, the end solution was as simple as creating a fake dummy MBR record for this action, witch obvioulsy needs some specific details in it for this to happened. Doesn't matter if the partition is with what ever OS you want and as many as you want really, even if the MBR is limited to 4 only.

You create a HEX file with the following content in it.

00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 01 00 ee fe ff ff 01 00 00 00 af ea 42 25 00 00 |............B%..| 000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200

I saved this in a file called dummymbr.

Then I needed to boot the MAC laptop in OpenBSD, well, that's what I am more comfortable with, so use what ever you like I guess, but this was good.

First step was to by an identical drive to do the backup to it, so I could experiment with.

I did this first thing n the morning when the computer store open here. I was in line to get the drive.

I got the exact same model the previously, just in case.

Western Digital 250 GB Sata, model WD2500BEVSRTL

I took the old drive out of the laptop and put it into an external USP to Sata enclosure. Why, well, the external unit is self power and I figure it would take some time and writing should take more power then reading form it, so I figure may as well put the new drive in the laptop and the original drive external to save on the USB, just in case.

I also got a USB memory stick, 4GB and pop in my OpenBSD CD into the laptop and did an install on the USB stick view as SD0. Didn't do any special partition, just one / and called it recover. (;>

After it was installed on the USB, well, the laptop didn't boot from the USB stick. (;<

So, I needed to find a way to get that going.

I downloaded the refit ISO image and created myself a CD with it.

Get it from the project here:

http://refit.sourceforge.net/

Then pop it in the MAC laptop and holding the c key to boot from the CD with my OpenBSD USB stick in the laptop USB port, it saw it and allow me to boot directly in OpenBSD.

I did that and then finally I was in some familiar territory.

I plug the USB/Sata external inclosure's in the Laptop and OpenBSD saw it and presented it as SD1. SD0 is by UBS flash.

Then I did the image of the drive from the external broken one to the new clean internal one.

dd if=/dev/rsd1c of=/dev/rwd0c bs=1m

And let that go. Took for ever and I had no clue of progress.

Then 11072 seconds later it was done. Men, I am glad that was UBS 2.0 as 1.1, or 1.0 I would still be there next week!

Then unplug the original drive, put it away just to be safe!

Then started the fun part. Well, not so fun but anyway at the end, it was simple. It is always simple when the right step are know damit!

So, with my HEX file as above on my flash drive with my copy of the broken drive in the laptop with the first block replace by the original install stoped.

I had to simply do:

dd if=/dummymbr of=/dev/rwd0c bs=512 count=1

Then I checked to be sure it was what I wanted:

hexdump -Cn512 /dev/rwd0c

So, it was replaced by what I wanted.

Then just rebooted the laptop and hope for the best after countless other tests and try.

Then to normal refit came up with the MAC partition and the OpenBSD have no boot, but that's for an other day, however, the data, just like before with all data intact and nothing lost at all anywhere!

Then you can once more go back as the original time to use the partition tool of refit to update the MBR as it should be, etc.

The master MBR was replaced by the copy of the backup GPT and all is good.

So, many thanks for the support and the encouragement along the way.

Now I can go get a few well deserved BEER!!!!!!

Best,

Daniel

Reply via email to