Subject: Re: mbrlabel problem
To: David Laight <david@l8s.co.uk>
From: Pavel Cahyna <pcah8322@artax.karlin.mff.cuni.cz>
List: tech-kern
Date: 09/16/2005 22:51:20
On Fri, Sep 16, 2005 at 09:13:31PM +0100, David Laight wrote:
> On Fri, Sep 16, 2005 at 09:49:37PM +0200, Pavel Cahyna wrote:
> > Hello,
> > 
> > I'm on alpha and want to get data from BSD partition on a disk from a
> > NetBSD/i386 machine. So I did:
> > mbrlabel sd2
> > 
> > the result was surprising:
> > 
> > ----
> > Found 4.2BSD partition; size 12287983 (5999 MB), offset 63
> >   adding 4.2BSD partition to slot a.
> > 
> > 3 partitions:
> > #        size    offset     fstype [fsize bsize cpg/sgs]
> >  a:     16384        63     4.2BSD   1024  8192    16  # (Cyl.      0*-     13*)
> >  c:  35937500         0     unused      0     0        # (Cyl.      0 -  29898*)
> > 
> > Not updating disk label.
> > ----
> > 
> > Size 6GB for a BSD partition looks reasonable, but why is later the size
> > displayed as 16386 sectors, insead of 12287983 as in the first message? 
> > This is on 3.0_BETA.
> > 
> > Please, isn't this a bug? Or is just my expectation wrong?
> 
> Well, mbrlabel generates a netbsd disklabel from the fdisk partition layout.

I know, but why did it report a BSD partition of correct size and then
printed a disklabel with this partition so small? I doubt that I had a
fdisk partition layout with such small BSD partition.

(although I can't verify it because fdisk doesn't exist on alpha.)

> What you want to do is locate the netbsd label that is in the 2nd sector of
> the pbr and make the alpha system use that.
> 
> You might find you can copy the label to where the alpha system will
> find it, eg:
> # dd if=/dev/sd2c skip=64 seek=1 count=1 of=/dev/sd2c

Should't be possible to use mbrlabel -w sd2, which will create sd2a with
the correct offset, and then use disklabel to read the label from
/dev/sd2a with "disklabel -r /dev/sd2a"? I tried it, but it printed only
"disk label corrupted". Would the kernel recognize it if disklabel
didn't?

Thanks and bye	Pavel