9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Michael Teichgräber" <mt@wmipf.in-berlin.de>
To: 9fans@cse.psu.edu
Subject: [9fans] using opendisk on a sd partition
Date: Mon, 13 Nov 2006 20:34:17 +0100	[thread overview]
Message-ID: <1163446457.4558c8b9db16b@webmail.in-berlin.de> (raw)

Hi,

when opening a partition file of an sd disk with  `opendisk',
what am I supposed to get in disk->(c h s) -- the c/h/s value
of the underlying disk visible as `data', or rather a value
where `c' corresponds to the size of the partition (not of
the whole disk)?

If I have a disk interface containing `ctl', `data' and a
`plan9' partition, I get for instance c/h/s=8/16/32 when using
opendisk on `data', but c/h/s=7/16/32 using `plan9'.
[Initially I tried to disk/format a partition created by
disk/mbr on a very small disk, and noticed that the fat system
created did not cover the whole partition. To my surprise,
calling format with `-v' reported that smaller number of `c' above.]

Looking at partitiongeometry in libdisk/disk.c, values for
h and s are derived from the partition table of `data' (if
such a file is present).  Disk->c is calculated by dividing
the previously determined size of the opened file (disk->secs)
by h and s, so obviously this must result in different values
when doing opendisk("plan9") resp. opendisk("data").

http://9fans.net/archive/2000/10/140 describes a fix that was
introduced to allow the use of disk/* programs on partitions
containing uninitialized or invalid partition bootsectors. The
main part is the trick, that the pbs of `data', i.e. the mbr,
is loaded first, rather than the partition's own, perhaps
uninitialized, pbs.

The method how disk->c is calculated, remained the same:
disk->secs/((h+1)*s) -- meaning the number of cylinders covered
by the partition. For partitions spanning whole cylinders,
this value would be accurate, but it would be too small
for partitions that don't start (or end) at a cylinder boundary, like
often the first one, or partitions created by prep.

Maybe the number of cylinders of the whole disk is of no much
use when using opendisk on a partition, but, since the concept of
`c/h/s' in most(?) cases is related to a whole disk, wouldn't
that make more sense than a probably too small per-partition value
(which could, if needed, also be recalculated using disk->secs)?

Michael


             reply	other threads:[~2006-11-13 19:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-13 19:34 Michael Teichgräber [this message]
2006-11-13 23:05 ` Russ Cox
2006-11-14  0:49   ` Michael Teichgräber

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=1163446457.4558c8b9db16b@webmail.in-berlin.de \
    --to=mt@wmipf.in-berlin.de \
    --cc=9fans@cse.psu.edu \
    /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;
as well as URLs for NNTP newsgroup(s).