NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: install/47671: How do I manually add an extra MBR style disk?
The following reply was made to PR install/47671; it has been noted by GNATS.
From: Andrew Cagney <andrew.cagney%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: install-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: Re: install/47671: How do I manually add an extra MBR style disk?
Date: Sat, 23 Mar 2013 20:29:06 -0400
--bcaec5555662aa776a04d8a0c64a
Content-Type: text/plain; charset=UTF-8
> andrew.cagney%gmail.com@localhost (Andrew Cagney) writes:
>
> >Here's the output from several further runs with -w:
>
> ># mbrlabel /dev/rsd0
> >Found MSDOS partition; size 1073741824 (524288 MB), offset 2048
> > skipping existing MSDOS partition at slot a.
> >Found 4.2BSD partition; size 524288000 (256000 MB), offset 1073743872
> > adding 4.2BSD partition to slot e.
>
> >5 partitions:
> ># size offset fstype [fsize bsize cpg/sgs]
> > a: 1073741824 2048 MSDOS # (Cyl. 1 -
> >524288)
> > b: 16384 1073743872 4.2BSD 1024 8192 16 # (Cyl. 524289 -
> >524296)
> > c: 1952151552 0 unused 0 0 # (Cyl. 0 -
> >953198)
> > d: 16384 1073743872 4.2BSD 1024 8192 16 # (Cyl. 524289 -
> >524296)
> > e: 16384 1073743872 4.2BSD 1024 8192 16 # (Cyl. 524289 -
> >524296)
>
> >notice how it is breeding partitions ...
>
> That looks like a non-i386 system (c seems to be the raw partition)
> and a bug.
>
Yes, it is a Pi. (arm). 1tb usb disk so C is the full disk. It the disk
is meant to have two partitions and some free space:
From dmesg:
sd0 at scsibus0 target 0 lun 0: <WD, My Passport 070A, 1030> disk fixed
sd0: fabricating a geometry
sd0: 930 GB, 953199 cyl, 64 head, 32 sec, 512 bytes/sect x 1952151552
sectors
and from fdisk:
fdisk: Cannot determine the number of heads
Disk: /dev/rsd0c
NetBSD disklabel disk geometry:
cylinders: 953199, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 1952151552
BIOS disk geometry:
cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
total sectors: 1952151552
Partitions aligned to 2048 sector boundaries, offset 2048
Partition table:
0: Primary DOS with 32 bit FAT - LBA (sysid 12)
start 2048, size 1073741824 (524288 MB, Cyls 0-66837/118/33)
1: NetBSD (sysid 169)
start 1073743872, size 524288000 (256000 MB, Cyls
66837/118/34-99472/225/17)
PBR is not bootable: All bytes are identical (0xff)
2: <UNUSED>
3: <UNUSED>
Hmm, the man page has "The raw partition (typically partition c, but d on
i386 and some other platforms) is left alone during this process.". Why?
Shouldn't it try to always try to make C the NetBSD partition, and D the
disk?
And to get off topic, instead of starting A up, would it be better to pack
the other partitions at the end of the table, keep A (root) and B (swap)
free? The first thing I'm going to do with disklabel is that shuffle.
> For some reason mbrlabel forces the size of a BSD partition to 16384,
> which also defeats the duplicate detection. BSD partitions are those
> with an MBR type of
>
> 165 MBR_PTYPE_386BSD
> 166 MBR_PTYPE_OPENBSD
> 168 MBR_PTYPE_APPLE_UFS
> 169 MBR_PTYPE_NETBSD
>
> That's probably done because BSD partitions also use the other
> parameters (fsize,bsize,cpg/sgs) that can only be guessed without
> further analyzing the disk contents.
>
Fdisk seems to know. This behavior seems to make mbrlabel less useful. I
was hoping it could predictably pre-populate and write a disklabel.
>
> The bug doesn't usually show up on i386 systems because the only
> BSD type MBR partition found is usually the raw partition which
> is ignored anyway.
>
>
>
> >A reboot, however, seems to have flushed what ever was going wrong:
>
> That's because 'w' alone doesn't write to the disk but only updates the
> in-core version of the disklabel.
>
Ah. I should be specifying -w -r.
--bcaec5555662aa776a04d8a0c64a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=3D=
"im">
=C2=A0<a
href=3D"mailto:andrew.cagney%gmail.com@localhost">andrew.cagney%gmail.com@localhost</a=
> (Andrew Cagney) writes:<br>
<br>
=C2=A0>Here's the output from several further runs with -w:<br>
<br>
=C2=A0># mbrlabel /dev/rsd0<br>
=C2=A0>Found MSDOS partition; size 1073741824 (524288 MB), offset 2048<b=
r>
=C2=A0> =C2=A0skipping existing MSDOS partition at slot a.<br>
=C2=A0>Found 4.2BSD partition; size 524288000 (256000 MB), offset 107374=
3872<br>
=C2=A0> =C2=A0adding 4.2BSD partition to slot e.<br>
<br>
=C2=A0>5 partitions:<br>
=C2=A0># =C2=A0 =C2=A0 =C2=A0 =C2=A0size =C2=A0 =C2=A0offset =C2=A0 =C2=
=A0 fstype [fsize bsize cpg/sgs]<br>
=C2=A0> a: 1073741824 =C2=A0 =C2=A0 =C2=A02048 =C2=A0 =C2=A0 =C2=A0MSDOS=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # (C=
yl. =C2=A0 =C2=A0 =C2=A01 -<br>
=C2=A0>524288)<br>
=C2=A0> b: =C2=A0 =C2=A0 16384 1073743872 =C2=A0 =C2=A0 4.2BSD =C2=A0 10=
24 =C2=A08192 =C2=A0 =C2=A016 =C2=A0# (Cyl. 524289 -<br>
=C2=A0>524296)<br>
=C2=A0> c: 1952151552 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 =C2=A0 =C2=A0 unused=
=C2=A0 =C2=A0 =C2=A00 =C2=A0 =C2=A0 0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# (Cyl. =
=C2=A0 =C2=A0 =C2=A00 -<br>
=C2=A0>953198)<br>
=C2=A0> d: =C2=A0 =C2=A0 16384 1073743872 =C2=A0 =C2=A0 4.2BSD =C2=A0 10=
24 =C2=A08192 =C2=A0 =C2=A016 =C2=A0# (Cyl. 524289 -<br>
=C2=A0>524296)<br>
=C2=A0> e: =C2=A0 =C2=A0 16384 1073743872 =C2=A0 =C2=A0 4.2BSD =C2=A0 10=
24 =C2=A08192 =C2=A0 =C2=A016 =C2=A0# (Cyl. 524289 -<br>
=C2=A0>524296)<br>
<br>
=C2=A0>notice how it is breeding partitions ...<br>
<br>
</div>=C2=A0That looks like a non-i386 system (c seems to be the raw partit=
ion)<br>
=C2=A0and a bug.<br></blockquote><div><br></div><div><br></div><div>Yes, it=
is a Pi. =C2=A0(arm). =C2=A01tb usb disk so C is the full disk. =C2=A0It t=
he disk is meant to have two partitions and some free space:</div><div><br>=
</div><div>From dmesg:</div>
<div><br></div><div><div>sd0 at scsibus0 target 0 lun 0: <WD, My Passpor=
t 070A, 1030> disk fixed</div><div>sd0: fabricating a geometry</div><div=
>sd0: 930 GB, 953199 cyl, 64 head, 32 sec, 512 bytes/sect x 1952151552 sect=
ors</div>
</div><div><br></div><div>and from fdisk:</div><div><br></div><div><div>fdi=
sk: Cannot determine the number of heads</div><div>Disk: /dev/rsd0c</div><d=
iv>NetBSD disklabel disk geometry:</div><div>cylinders: 953199, heads: 64, =
sectors/track: 32 (2048 sectors/cylinder)</div>
<div>total sectors: 1952151552</div><div><br></div><div>BIOS disk geometry:=
</div><div>cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cy=
linder)</div><div>total sectors: 1952151552</div><div><br></div><div>Partit=
ions aligned to 2048 sector boundaries, offset 2048</div>
<div><br></div><div>Partition table:</div><div>0: Primary DOS with 32 bit F=
AT - LBA (sysid 12)</div><div>=C2=A0 =C2=A0 start 2048, size 1073741824 (52=
4288 MB, Cyls 0-66837/118/33)</div><div>1: NetBSD (sysid 169)</div><div>=C2=
=A0 =C2=A0 start 1073743872, size 524288000 (256000 MB, Cyls 66837/118/34-9=
9472/225/17)</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 PBR is not bootable: All bytes are identic=
al (0xff)</div><div>2: <UNUSED></div><div>3: <UNUSED></div></di=
v><div><br></div><div><br></div><div>Hmm, the man page has "The raw pa=
rtition (typically partition c, but d on i386 and some other platforms) is =
left alone during this process.". =C2=A0Why? =C2=A0 Shouldn't it t=
ry to always try to make C =C2=A0the NetBSD partition, and D the disk?</div=
>
<div><br></div><div>And to get off topic, instead of starting A up, would i=
t be better to pack the other partitions at the end of the table, keep A (r=
oot) and B (swap) free? =C2=A0The first thing I'm going to do with disk=
label is that shuffle.</div>
<div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex">
<br>
=C2=A0For some reason mbrlabel forces the size of a BSD partition to 16384,=
<br>
=C2=A0which also defeats the duplicate detection. BSD partitions are those<=
br>
=C2=A0with an MBR type of<br>
<br>
=C2=A0165 MBR_PTYPE_386BSD<br>
=C2=A0166 MBR_PTYPE_OPENBSD<br>
=C2=A0168 MBR_PTYPE_APPLE_UFS<br>
=C2=A0169 MBR_PTYPE_NETBSD<br>
<br>
=C2=A0That's probably done because BSD partitions also use the other<br=
>
=C2=A0parameters (fsize,bsize,cpg/sgs) that can only be guessed without<br>
=C2=A0further analyzing the disk contents.<br></blockquote><div>=C2=A0</div=
><div><br></div><div>Fdisk seems to know. =C2=A0This=C2=A0behavior=C2=A0see=
ms to make mbrlabel less useful. =C2=A0I was=C2=A0hoping=C2=A0it could pred=
ictably pre-populate and write a disklabel.</div>
<div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
=C2=A0The bug doesn't usually show up on i386 systems because the only<=
br>
=C2=A0BSD type MBR partition found is usually the raw partition which<br>
=C2=A0is ignored anyway.<br></blockquote><div><br></div><div><br></div><div=
><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=3D"im"><br>
<br>
=C2=A0>A reboot, however, seems to have flushed what ever was going wron=
g:<br>
<br>
</div>=C2=A0That's because 'w' alone doesn't write to the d=
isk but only updates the<br>
=C2=A0in-core version of the disklabel.<br></blockquote><div><br></div><div=
>Ah. =C2=A0I should be specifying -w -r.</div><div><br></div></div>
--bcaec5555662aa776a04d8a0c64a--
Home |
Main Index |
Thread Index |
Old Index