All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: John Lane <util-linux@jelmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: fdisk geometry
Date: Thu, 26 Jul 2012 11:29:40 +0200	[thread overview]
Message-ID: <1343294980.2609.4.camel@offbook> (raw)
In-Reply-To: <50109E8D.2000702@jelmail.com>

On Thu, 2012-07-26 at 02:34 +0100, John Lane wrote:
> Hello, I'm in the middle of studying disk organisation to enhance my 
> understanding in this area. I have a few questions about fdisk (trying 
> to fill a gap in my knowledge if that's ok)...

use the source, Luke :)

> 
> In the below output of fdisk it shows (correctly) a geometry of 224 
> heads, 56 sectors/track. I'm unclear about where this information comes 
> from. Normally a disk's geometry would be reported as 255 heads and 63 
> sectors. I explicitly partitioned this disk using a 224/56 geometry, so 
> the report is correct. I'd just like to understand:
> 
> (a) where fdisk gets the information about the geometry from in  this 
> specific case?

fdisk gets the information from (i) user input, (ii) what the
kernel/bios thinks the geometry is, with the HDIO_GETGEO ioctl and (iii)
by inferring it from the partition table geometry.

> (b) when fdisk defaults to 255/63 is that because it's hard coded that 
> way or is there another reason?

Correct.

> 
> I understand why it's 255/63 by default but haven't been able to 
> understand how the geometry is determined. I do know that it's all kind 
> of moot these days anyway because of sector based addressing but that 
> leads to one other question: given sector based addressing why does 
> fdisk even bother displaying a geometry any more ? Doesn't it just serve 
> to confuse?

That's because fdisk is/was mostly legacy code, we are currently
updating the program.

Cheers,
Davidlohr

> 
> # fdisk /dev/sda
> Welcome to fdisk (util-linux 2.21.2).
> 
> Changes will remain in memory only, until you decide to write them.
> Be careful before using the write command.
> 
> 
> Command (m for help): p
> 
> Disk /dev/sda: 80.0 GB, 80026361856 bytes
> 224 heads, 56 sectors/track, 12460 cylinders, total 156301488 sectors
> Units = sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disk identifier: 0xc4c4122e
> 
>     Device Boot      Start         End      Blocks   Id  System
> /dev/sda1   *          56      501759      250852   83  Linux
> /dev/sda2          501760   156298239    77898240   8e  Linux LVM
> 
> Command (m for help): q
> 
> Many thanks for your time,
> John Lane.
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



  reply	other threads:[~2012-07-26  9:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26  1:34 fdisk geometry John Lane
2012-07-26  9:29 ` Davidlohr Bueso [this message]
2012-07-26  9:57   ` Karel Zak
2012-07-26 10:29     ` Davidlohr Bueso
2012-07-26 10:38       ` Karel Zak
2012-07-28  0:20   ` John Lane

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=1343294980.2609.4.camel@offbook \
    --to=dave@gnu.org \
    --cc=util-linux@jelmail.com \
    --cc=util-linux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.