From: Martins <mar@ml.lv>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] He's baaaaaack!
Date: Mon, 25 Jul 2005 23:24:32 +0300 [thread overview]
Message-ID: <6.1.2.0.2.20050725231959.01be9e70@pop.ml.lv> (raw)
In-Reply-To: <42E52EB2.4080607@asmallpond.org>
it is possible with fdisk, i did it and it worked, and this is steps i
followed, step 7 wasnt necesary for me:
Fix for the XP dual boot problem
* From: Radu Cornea <ccradu yahoo com>
* To: For testers of Fedora Core development releases <fedora-test-list
redhat com>
* Subject: Fix for the XP dual boot problem
* Date: Tue, 18 May 2004 22:37:57 -0700 (PDT)
Like other people on this list I was affected by the bug which makes the
XP partition in a dual boot configuration inaccessible after installing
Fedora. Below are the steps I used to restore the partition table to its
original configuration.
Some people mentioned a fix that involved setting the hard disk
configuration to LBA in the BIOS, but that may not work in some cases (I
have an old IBM Thinkpad which does not allow it).
By looking at the partition information as printed by fdisk after the
partition is corrupted, it seems that the bug affects only the C/H/S
values, the LBA are still correct. Even the fdisk manual specifies that
"DOS uses C/H/S only, Windows uses both [C/H/S and LBA], Linux never uses
C/H/S". This means that the correct information is still there but just
one copy is correct, the LBA one (most people affected said they could
access the Windows partition from Linux just fine). The procedure below
attempts to regenerate the MBR from scratch using the LBA values. In most
cases the original disk geometry had 255 (or 240) as number of heads
initially and was changed to 16 after the partition was corrupted by FC2.
More info about the bug can be found here:
https://bugzilla.redhat.com/bugzill...g.cgi?id=115980
https://bugzilla.redhat.com/bugzill...g.cgi?id=113201
This did work for me. I don't guarantee it will work for everyone, use it
at your own risk...
You need a bootable Linux CD (e.g. Knoppix) and a DOS system disk with
fdisk on it.
Here are the steps I followed:
1. boot from Knoppix or other bootable Linux CD (using the Fedora rescue
CD or booting in the newly installed system in single mode, ro mounted
may work too, but I haven't tried)
2. save the content of the MBR (and possibly all the boot sectors from
the partitions). This is important in case something goes wrong and you
want to restore later:
$ dd if=/dev/hda of=mbr.img bs=512 count=1
3. run fdisk, go into expert mode and write down (or save into a file)
the starting sector (NOT block), end sector and type for each partition
(example below):
$ fdisk /dev/hda
Command: u (change units to sectors)
Command: p (print)
Example output:
Device Boot Start End Blocks Id System
/dev/hda1 * 63 33732719 16866328+ 7 HPFS/NTFS
/dev/hda2 74692800 78140159 1723680 1c Hidden W95 FAT32
(LBA)
/dev/hda3 35834400 74692799 19429200 83 Linux
/dev/hda4 33732720 35834399 1050840 82 Linux swap
4. completely erase the MBR by writing zeros to it (you may skip this
step, I am not sure if it is really needed, but this way it worked for
me):
$ dd if=/dev/zero of=zero.img bs=512 count=1
$ dd if=zero.img of=/dev/hda
5. force the original number of heads. In my case (20Gb in a Thinkpad)
this was 240, but in most other cases it would be 255. See this post for
more info:
http://groups.google.com/groups?hl=....bofh.it&rnum=4
Using fdisk this will also create a new DOS partition table and restore
the original partitions:
$ fdisk -H 255 /dev/hda # or 240 for some configurations
Command: o (create new partition table)
6. by now you have a newly generaed partition table, with the original
disk geometry. Recreate the partitions as they were before:
Command: n (new partition)
Primary partition (p)
Partition number: 1
First cylinder: 63 # beginning of first partition
Last cylinder or +size[...]: 33732719 # end of first partition
Command: t (change type)
Partition number: 1
Hex code: 07 # they type of the partition
Repeat for all 4 partitions. Verify at the end that the start/end/id are
correct:
Command: p (print)
If everything is correct, write the partition table to the disk and exit:
Command: w (write)
Command: q (quit)
7. in my case, I had to run an extra "fdisk /mbr" using the DOS bootdisk
(may work with a XP installation CD too, but I haven't tried). After
that, everything worked fine, the partition table was back to the
original configuration.
If you have the GRUB in the MBR, the "fdisk /mbr" will overwrite it so
you may want to restore it later (but use the Knoppix CD, not FC2,
otherwise you may end up where you started if the bug is in grub). On my
machine GRUB was installed in the Linux partition so it wasn't affected.
You can return to the original MBR at any time by writing the saved image
to the disk (in case this fix does not work for you) as long as you only
make changes to the MBR:
$ fdisk if=mbr.img of=/dev/hda
This is it, I hope it works for others, if it does please let me know.
--
Radu
At 21:25 2005.07.25., you wrote:
>Martins wrote:
>
>>
>>>
>>>Um, if you do this, you will more than likely destroy the filesystems as
>>>well, because the new partitions will not line up exactly with the old ones.
>>>
>>>Anyway I don't think this is the problem. Afterall, WinXP booted fine
>>>before on this drive with LBA disabled, so something else is up. If you
>>>already made the right changes to the boot.ini file, then I suspect that
>>>a "fixboot" from the recovery mode of the WinXP CD will be necessary.
>>>This should not overwrite the MBR, only the boot loader that is at the
>>>beginning of the windows partition.
>>>
>>>-Richard
>>>
>>>--
>>>gentoo-user@gentoo.org mailing list
>>
>>
>>there is no worry, writing new partition table give it the same values
>>(partition start, end, type, order) as before and not a single bit is lost
>
>What I am saying is that this is not possible with fdisk, because fdisk
>will insist on creating the new partitions aligned on cylinder boundaries,
>which will have moved in terms of logical sectors. Example:
>
>Let's say you want a 100MB partition, or about 200000 512-byte sectors:
>
>With non-LBA geometry, the math is 200000 sectors / (63 sectors/track * 16
>heads) = 198.41 cylinders. Now round down to 198 cylinders and you get
>199584 sectors in your partition
>
>With LBA geometry, the math is 200000 / (63 sectors/track * 255 heads) =
>12.449 cylinders. Again, round down to 12, and you get 192780 sectors in
>your partition. You can round up to 13 and get 208845, but you *cannot*
>get 199584. Possibly with another partitioning tool that allows you to
>specify the starting and ending heads as well as cylinders, but not with fdisk.
>
>It is *possible* for this to work if you have just one huge partition, or
>if your partitions happen to end at even multiples of both (63 * 255) and
>(63 * 16).
>
>And just for the sake of accuracy, the cylinder alignment thing is true
>for all partitions except:
>
>- Cylinder 0, head 0 is reserved for the MBR, so any partition starting at
>cylinder 0 actually starts at head 1.
>- Logical partitions actually start at head 0, sector 1, because the first
>sector contains another partition table that points to the next partition.
>
>-Richard
>
>--
>gentoo-user@gentoo.org mailing list
--
gentoo-user@gentoo.org mailing list
next prev parent reply other threads:[~2005-07-25 20:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-25 0:39 [gentoo-user] He's baaaaaack! maxim wexler
2005-07-25 1:53 ` Martins Steinbergs
2005-07-25 4:35 ` maxim wexler
2005-07-25 4:50 ` Martins Steinbergs
2005-07-25 5:42 ` maxim wexler
2005-07-25 6:28 ` Martins Steinbergs
2005-07-25 6:44 ` Richard Fish
2005-07-25 15:02 ` Martins
2005-07-25 18:25 ` Richard Fish
2005-07-25 20:24 ` Martins [this message]
2005-07-26 20:23 ` Richard Fish
2005-07-25 21:13 ` Zac Medico
2005-07-26 20:16 ` [gentoo-user] He's baaaaaack!--SOLVED maxim wexler
2005-07-26 20:27 ` Richard Fish
2005-07-25 18:10 ` [gentoo-user] He's baaaaaack! maxim wexler
2005-07-25 5:26 ` Richard Fish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6.1.2.0.2.20050725231959.01be9e70@pop.ml.lv \
--to=mar@ml.lv \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox