[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS

From: Anton Altaparmakov
Subject: Re: [RFC] Restoring HDIO_GETGEO semantics (was: Re: workaround for BIOS / CHS stuff)
Date: Sat, 3 Jul 2004 15:40:01 +0100 (BST)

On Sat, 3 Jul 2004, Andrew Clausen wrote:
> On Sat, Jul 03, 2004 at 08:53:39AM +0100, Anton Altaparmakov wrote:
> > On Sat, 3 Jul 2004, Andrew Clausen wrote:
> > > In any case, I don't have any evidence that anything is wrong.  On my
> > > computer, I can tell the BIOS to use CHS geometry, (as opposed to
> > > "Auto", "LBA" or "Large") modify the partition table to set the CHS
> > > start/end of the Windows partition to 0, 1024, or anything I like, and
> > > Windows STILL works.  I can't get anything to break!
> > 
> > Which version of Windows?
> XP home edition (the green box)

Hm, I only ever tried XP Pro.

> > Does it use NTFS as both the boot and system drive?
> I am using a single NTFS partition.

I have lots of partitions (mostly Linux, NTFS is at end of disk).

> Note: I reversed-engineered the Windows FAT bootstrap code.  My analysis
> is contained in the file doc/FAT in the Parted source distribution.  I
> concluded that Windows uses LBA if the LBA flag is set in the boot
> partition table entry.  (i.e. the partition type includes LBA in the
> fdisk codes - this corresponds to a bit being set)

Interesting.  Maybe I don't have this bit set?

> > > So, can anyone break Windows?
> > 
> > Easily.  Modify any of the relevant values in the NTFS bootsector and 
> > windows will no longer boot.  So it clearly cares hugely about the 
> > geometry.  And at present there is no easy way for us to tell what it is 
> > so mkntfs and ntfsclone cannot create bootable partitions on 2.6 kernels.  
> > (Works fine on 2.4 using HDIO_GETGEO.)
> > 
> > The relevant fields are (see linux/fs/ntfs/layout.h or 
> > ntfsprogs/include/ntfs/layout.h) in the NTFS_BOOT_SECTOR in the 
> > 
> > u16 sectors_per_track; /* Required to boot Windows. */
> > u16 heads;             /* Required to boot Windows. */
> > u32 hidden_sectors;    /* Offset to the start of the partition relative 
> > to the disk in sectors.  Required to boot Windows. */
> I just set the first 2 of these fields to 0, and everything still works.
> Am I blessed?  (Or perhaps cursed!)

Odd.  Messing up any of the above three values makes my XP Pro fail to 

> Isn't hidden_sectors an LBA value (and hence irrelevant to this discussion)?

It is.

Best regards,

Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]