Subject: mbrlabel and extended partitions (NetBSD 1.6.1/i386)
To: None <current-users@netbsd.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: current-users
Date: 06/06/2003 21:27:03
I have a problem when trying to add FAT or NTFS partitions into in-core=20
disklabel when they are located inside extended disk partition.

Disk wd1 is 60Gb IMB <somtehing tralala> which have one big extended part=
ition=20
in MBR and one NTFS5 partition inside extended partition.

--- cut ---
bash-2.05# disklabel wd1
# /dev/rwd1d:
8 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 d: 120103200         0     unused      0     0         # (Cyl.    0 - 11=
9149)
 e: 115989300   4096575     unused      0     0         # (Cyl. 4064*-=20
119132*)
disklabel: boot block size 0
disklabel: super block size 0
--- cut ---

Now trying to locate MBR partitions on wd1 and add them into disklabel if=
 smth=20
found:

--- cut ---
bash-2.05# mbrlabel -w wd1
Found NTFS partition; size 115989237 (56635 MB), offset 4096638
  adding NTFS partition to slot a.

8 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 a: 115989237   4096638       NTFS                      # (Cyl. 4064*-=20
119132*)
 d: 120103200         0     unused      0     0         # (Cyl.    0 - 11=
9149)
 e: 115989300   4096575     unused      0     0         # (Cyl. 4064*-=20
119132*)

Updating in-core disk label.
--- cut ---

Ok, we found one new NTFS partition as we did expect and added it as wd1a=
, at=20
least it is reported so. Now checking wd1 disklabel:

--- cut ---
bash-2.05# disklabel wd1
# /dev/rwd1d:

8 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 d: 120103200         0     unused      0     0         # (Cyl.    0 - 11=
9149)
 e: 115989300   4096575     unused      0     0         # (Cyl. 4064*-=20
119132*)
disklabel: boot block size 0
disklabel: super block size 0
--- cut ---

=2E..and we can see that there are no wd1a as if mbrlabel didn't find any=
thing=20
:(

What i am doing wrong ?

Note that on the same system i have another [master] NTFS partition on wd=
0 but=20
this partition is declared as MBR partition i.e. not inside extended. And=
=20
above trick with "mbrlabel -w wd0" works excellent - it successfully adds=
 it=20
into in-core disklabel for wd0 so next i can mount it:

--- cut ---
bash-2.05# disklabel wd0
# /dev/rwd0d:

16 partitions:
#        size    offset     fstype  [fsize bsize cpg/sgs]
 a:   1091664   6144768     4.2BSD   1024  8192    87   # (Cyl. 6096 - 71=
78)
 b:   1050336   7236432       swap                      # (Cyl. 7179 - 82=
20)
 c:   5120640   6144768     unused      0     0         # (Cyl. 6096 - 11=
175)
 d:  39102336         0     unused      0     0         # (Cyl.    0 - 38=
791)
 e:   2978640   8286768     4.2BSD   1024  8192    86   # (Cyl. 8221 - 11=
175)
 f:  26828550  12273660       NTFS                      # (Cyl. 12176*-=20
38791*)
 g:   6136767        63    unknown                      # (Cyl.    0*- 60=
88*)
--- cut ---

What's wrong ? It looks like mbrlabel capable to read extended partitions=
=20
table but due to some reasons it cannot add it into in-core disklabel.

// wbr