So the actual partitions themselves are fine, it's just that the partition table and/or master boot record is messed up? So just rewrite that and leave the rest. the MBR is the first 512-bytes of your drive. the partition table is 64 bytes starting at byte 447. Either format a drive similiar(both use LBA) on a similiar/same computer to the one you have and copy the data from that, or create it by hand with a hex editor.
say we wanted to copy from hda to hdb... to store the good mbr do something like: dd if=/dev/hda of=/hda.mbr bs=1 count=512 then to write it just: dd if=/hda.mbr of=/dev/hdb because of the nt disk signature(4 bytes) in the mbr being necessary for proper booting(???) then perhaps you could get away with just copying the partition table using seek and skip: dd if=/hda.mbr.fixed of=/dev/hdb bs=1 skip=446 seek=446 count=64 If you could think of another way of just writing the mbr or partition table that would work too. maybe you could use windows fdisk to do this... you'd think you could, but it's windows so I can't say w/o checking. the basic idea is that if you get everything right(or mostly right) in the partition table and you don't touch the partitions you're cool. once a botched OpenBSD install completely erased my partition table so I wrote a shell script that repeatedly tried different starting positions until it got the right one(checked by trying to mount the partition and for the existence of certain files in the partition.) anyhoo, whatever way works best [for you] is the way to go... I would just as soon copy the files over to another drive and do a complete OS reinstall...you probably have some root kits or viruses you need to get rid of anyway. ;) > Message: 1 > Date: Sun, 12 Nov 2006 12:22:39 -0600 > From: Robert Citek <[EMAIL PROTECTED]> > Subject: Re: [cwe-lug] Fwd: Dual Boot Issue > To: Central West End Linux Users Group <[EMAIL PROTECTED]> > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=us-ascii > As for grub, I've experienced something similar. On a machine with > Windows XP, I used qtparted to resize the Windows partition and then > installed Linux with the 2.6 kernel (can't remember if it was Ubuntu or > Knoppix). Booting into Linux worked just fine, but booting into Windows > just wasn't working. IIRC, the problem was that resizing the Windows > partition caused the drive geometry to be written in a format that > Windows refused to understand. I could boot just fine into Linux and I > had no problems reading the Windows NTFS partition under Linux. I just > couldn't boot into Windows. > > Apparently, messing up the drive geometry is a known problem with the > 2.6 kernel. Of course, "messing up" depends on your perspective. Linux > doesn't have a problem with it, just Windows. > > The solution I used was truly a hack: > > 1) image the Windows and Linux partitions to an external drive > (FireWire) using Knoppix > 2) partition and format the original drive using the Windows install CD > in rescue mode: one big partition as NTFS. This created a partition > table the Windows could understand > 3) using Knoppix, lay down the Windows file system from the image on the > external drive > 4) resize the Windows partition using qtparted > 5) create the necessary Linux partitions with qtparted > 6) lay down the Linux partition from the images on the external drive > 7) reinstall grub > > Doing that was a pain, but it worked. If anyone knows of a better way, > I'd love to hear about it. > > Regards, > - Robert > > > -- [EMAIL PROTECTED] _______________________________________________ CWE-LUG mailing list [email protected] http://www.cwelug.org/ http://www.cwelug.org/archives/ http://www.cwelug.org/mailinglist/
