Re: Beware: Installation of "Red Hat-based" Linux distributions corruptWindows HDD!

Martin Stricker <[email protected]> Wed, 19 May 2004 23:44:10 +0200
Newsgroups gmane.linux.redhat.taroon,gmane.linux.redhat.ia64.general
Organization http://martin-stricker.de/ http://www.surfo.net/ http://www.masterportal24.com/cgi-bin/YaBB.cgi
Message-ID <[email protected]>
Hi Emeric!

I found out that there is a serious bug in the current installer, which
is causing wrong disk geometry stored in the MBR. Only Windows is using
that kind of info, so Linux is not affected. Below I will quote two
messages from the fedora-test-list. The first from Gene C. deals with a
method to avoid disk geometry corruption, the second from Radu Cornea
shows a way to repair a damaged disk. I hope these mails will be helpful
for you! If you want more information, there was quite a discussion on
fedora-test-list about this which I didn't follow. You can find it here:
http://www.redhat.com/archives/fedora-test-list/2004-May/thread.html
(look for the thread "Fix for the XP dual boot problem" starting with
http://www.redhat.com/archives/fedora-test-list/2004-May/msg02114.html )

Best regards,
Martin Stricker
-- 
Homepage: http://www.martin-stricker.de/
Linux Migration Project: http://www.linux-migration.org/
Moeh for Kanzler! ;-) http://www.yes-moeh.de/
Webmaster-Forum: http://www.masterportal24.com/cgi-bin/yindex.cgi
Deutscher Science Fiction Preis http://www.dsfp.de/ verliehen vom
Science Fiction Club Deutschland e. V.: http://www.sfcd-online.de/
Red Hat Linux 9 for low memory: http://www.rule-project.org/
Registered Linux user #210635: http://counter.li.org/

First message:

"Gene C." wrote:
> 
> OK, the process which was posted to the mailing list may work to fix things
> when they get screwed up.  However, I have used a different approach which
> works for me ... don't let things get screwed up.
> 
> When I install Fedora (and this has also happened with RHL at some times) and
> the installer gripes that the partition table has errors, it is usually the
> case that the disk was partitioned with LBA (and fdisk).  The system I have
> does not use XP but does have Win2k installed.  When the problem occurs, I
> boot the Fedora installer and specify the LBA values ... for example, I used:
> 
>    linux  hda=7476,255,63
> 
> when I installed FC2.  This system has Maxtor 60GB disks and these are the LBA
> values.  When I do this, FC2 install uses the LBA values I specified.  After
> installation, I can boot Win2k or any of the FC1 or FC2 systems I have
> installed.
> 
> Your milage may vary but this works for me.
> --
> Gene
> 
> --
> fedora-test-list mailing list
> [email protected]
> To unsubscribe:
> http://www.redhat.com/mailman/listinfo/fedora-test-list

Second message:

Radu Cornea wrote:
> 
> 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/bugzilla/show_bug.cgi?id=115980
> https://bugzilla.redhat.com/bugzilla/show_bug.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=en&lr=&ie=UTF-8&selm=1Gjko-6Y1-5%40gated-at.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
> --
> fedora-test-list mailing list
> [email protected]
> To unsubscribe:
> http://www.redhat.com/mailman/listinfo/fedora-test-list


--
Taroon-beta-list mailing list
[email protected]
http://www.redhat.com/mailman/listinfo/taroon-beta-list