public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Seewer Philippe <philippe.seewer@bfh.ch>
To: Francis Moreau <francis.moro@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Disk geometry from /sys
Date: Wed, 16 Apr 2008 09:49:39 +0200	[thread overview]
Message-ID: <4805AF93.90209@bfh.ch> (raw)
In-Reply-To: <38b2ab8a0804150040i14840a9fudc3b95ba80d52ac1@mail.gmail.com>

Hi,

Francis Moreau wrote:
> Hi Seewer,
> 
> On Mon, Apr 14, 2008 at 2:57 PM, Seewer Philippe <philippe.seewer@bfh.ch> wrote:
>>  As you've problably seen from the other answers, disk geometry is (except
>> for a few older devices) unneeded inside the Linux kernel.
> 
> Yes but I'm doing userspace stuff and that's the reason I was asking for the
> sysfs thing.
> 
>> I'd say thats the
>> reason why there's no sysfs export and I'd further guess disk geometry is an
>> artifact most would like to get rid of (or pushed into userspace).
>>
> 
> Well, I looked at sfdisk(8) and parted(8) source code and they all need the
> geometry description. If I understood correctly the reason why is that it
> 'prefers' to align partition sizes/starts on a cylinder boundary because some
> bootloaders probably use CHS addressing, but I'm really not sure.
Yes indeed, mainly in the (w)intel world though.

> 
>>  Anyway, if you really need it, try the patch below. Should apply cleanly to
>> version 2.6.23.1 and gives you a geometry/ directory for each block device
>> providing the getgeo function. It adds a setgeo counterpart for some
>> subsystems as well, allowing 'echo something > ...' so please be careful.
>>
> 
> Thanks but I probably won't use it. Using sfdisk, for example, is a
> more portable
> way to get the geometry from a script.

Correct. Though be really careful which geometry you are requesting:

root@local:/# sfdisk -g /dev/sda
/dev/sda: 7296 cylinders, 255 heads, 63 sectors/track
root@local:/# 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, versus the second one which 
tries to guess a disks geometry by looking at the current partition 
table. Which might be just as wrong since its only necessary for bios 
and/or bootloader. Really depends on what you need.

Cheers
Philippe


  reply	other threads:[~2008-04-16  7:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 20:53 Disk geometry from /sys Francis Moreau
2008-04-09 21:28 ` Lennart Sorensen
2008-04-09 21:52   ` Alan Cox
2008-04-09 22:16   ` Bernd Eckenfels
2008-04-10 14:52     ` Lennart Sorensen
2008-04-10 19:23   ` Francis Moreau
2008-04-09 21:57 ` Mark Lord
2008-04-10 19:05   ` Francis Moreau
2008-04-10 19:53     ` Mark Lord
2008-04-10 12:22 ` linux-os (Dick Johnson)
2008-04-10 19:15   ` Francis Moreau
2008-04-10 13:58 ` Bill Davidsen
2008-04-14 12:57 ` Seewer Philippe
2008-04-15  7:40   ` Francis Moreau
2008-04-16  7:49     ` Seewer Philippe [this message]
2008-04-17 14:09       ` Francis Moreau
2008-04-17 14:49         ` Seewer Philippe
2008-04-18 13:22           ` Mark Lord
2008-04-18 13:37             ` Seewer Philippe
2008-04-22 20:11               ` Francis Moreau
2008-04-23  6:44                 ` Seewer Philippe
2008-04-23  6:56                   ` Francis Moreau
2008-04-22 20:16             ` Francis Moreau
2008-04-22 22:44               ` Mark Lord
2008-04-23  6:53                 ` Seewer Philippe
2008-04-23  7:02                 ` Francis Moreau
2008-04-23  9:33                   ` Seewer Philippe
2008-04-23 13:47                   ` Mark Lord
2008-04-22 20:10           ` Francis Moreau
2008-04-23  6:48             ` Seewer Philippe

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=4805AF93.90209@bfh.ch \
    --to=philippe.seewer@bfh.ch \
    --cc=francis.moro@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox