From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] BUG: disk/fdisk.c: corrupts MBR
Date: Sat, 7 Jan 2012 14:04:51 -0500 [thread overview]
Message-ID: <1c3ba45416e47236eedd6ca05863d751@chula.quanstro.net> (raw)
In-Reply-To: <20120107182908.GA3674@polynum.com>
On Sat Jan 7 13:30:33 EST 2012, tlaronde@polynum.com wrote:
> Hello,
>
> Since I'm playing with the installation, I have been hit once again
> with disk/fdisk corrupting the MBR and rendering other systems
> unbootable.
>
> The explanation is arithmetic truncation. disk/fdisk.c does this:
>
> p->start = lba/sec2cyl;
>
> and, if modifications are done (for example creating a Plan9 partition,
> of marking a primary partition active), when written back, the entries
> are "restored" by:
>
> *endlba = (vlong)p->start*sec2cyl;
>
> Of course, if the values were not integer multiples of sec2cyl, the
> entry point for the PBS is corrupt. (For example, on *BSD, the principle
> is the same as for Plan9: a "primary" partition is a sequence of
> adjacent bytes, furthermore subdivided; but one special subdivision
> [a] is at the same offset (at start) and holds the bootcode and a
> disklabel describing the subdivision; if the MBR is corrupt, neither
> boot nor disklabel so user can conclude: everything lost). And the first
> travel in the flying saucer will also be the last...
can you just set sec2cyl=1?
- erik
next prev parent reply other threads:[~2012-01-07 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-07 18:29 tlaronde
2012-01-07 19:04 ` erik quanstrom [this message]
2012-01-07 19:22 ` tlaronde
2012-01-07 19:30 ` erik quanstrom
2012-01-07 20:13 ` tlaronde
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=1c3ba45416e47236eedd6ca05863d751@chula.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/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).