lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4808A09B.6090106@rtr.ca>
Date:	Fri, 18 Apr 2008 09:22:35 -0400
From:	Mark Lord <lkml@....ca>
To:	Seewer Philippe <philippe.seewer@....ch>
Cc:	Francis Moreau <francis.moro@...il.com>,
	linux-kernel@...r.kernel.org
Subject: Re: Disk geometry from /sys

Seewer Philippe wrote:
> Hi,
> 
> Francis Moreau wrote:
>> Hello Seewer,
>>
>> On Wed, Apr 16, 2008 at 9:49 AM, Seewer Philippe 
>> <philippe.seewer@....ch> wrote:
>>>  Correct. Though be really careful which geometry you are requesting:
>>>
>>>  root@...al:/# sfdisk -g /dev/sda
>>>  /dev/sda: 7296 cylinders, 255 heads, 63 sectors/track
>>>  root@...al:/# sfdisk -G /dev/sda
>>>  /dev/sda: 116280 cylinders, 16 heads, 63 sectors/track
>>>
>>>  The first one is the kernels idea of a disks geometry which is 
>>> probably as
>>> often correct as it's just plain wrong,
>>
>> Sorry but I don't understand, what do you mean ?
> Take the example above. A disk with 255 heads? Not impossible but 
> improbable. Where's the value from?
> 
> -The physical disks behind the example is an older laptop IDE disk. 
> 'hdparm -I' shows 16 heads and 63 sectors, which is already an 
> approximated value anyway. See Dick Johnson's post about that.
..

That can sound a bit misleading.  The complete story, for ATA/SATA drives,
is that the disk has two geometries:  an internal physical one, with a 
fixed number of heads and cylinders, but variable sectors/track
(which normally varies by cylinder zone).

Software *never* sees or knows about that geometry, so ignore it.

The second geometry, is the one that the drive reports to software
as its "native" geometry.  This is what you see from "hdparm -I"
and friends, and this geometry is what has to be used by software
when using cylinder/head/sector (CHS) addressing for I/O operations.
The hardware interface has a limit of 4-bits for the head value,
so the maximum number of heads can never be more than 16.

Nobody uses CHS addressing for I/O operations, at least not on
any hardware newer than at least ten years old, so this geometry
is also unimportant for most uses.

That's what the drive knows about.

Software, for compatibility with the MS-DOS partition table scheme,
sometimes uses a "logical" geometry, where we "pretend" that a drive
can have up to 255 heads, which then allows more of the disk to be
described within the limitations of the partition table data layout.
That's where one frequently sees "255 heads", even though the drive
underneath uses 16 at the interface level, and probably as only 2
or 4 real heads inside the shell.

Cheers
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ