Subject: Re: Mount logical drive inside extended partition
To: None <port-i386@netbsd.org>
From: Georges Heinesch <geohei-ml@geohei.lu>
List: port-i386
Date: 10/29/2001 12:13:00
Quoting Rick Byers (28-Oct-01 17:01:53):

> Do you have a NetBSD partition on that drive?  If so, matching the
> disklabel to the partition information (with mbrlabel or manually)
> should do the trick.

I have 2 drives, wd0 and wd1. NetBSD is installed in wd1. There is an
extended partition (with logical partitions inside I'd like to mount)
on both drives.

Saying "disklabel wd0" shows d (entire disk), and the other 3
partitions (2 primary and 1 extended). Saying "disklabel -r wd0" just
reports that there is no disklabel.

----- cut here -----
dimension# disklabel wd0
# /dev/rwd0d:
type: ESDI
disk: Maxtor 91728D8  
label: fictitious
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 33750864
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0       # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize   cpg]
  d: 33750864        0     unused        0     0         # (Cyl.    0 - 33482)
  e:  4192902       63     unused        0     0         # (Cyl.    0*- 4159*)
  f: 25350570  8385930     unused        0     0         # (Cyl. 8319*- 33468*)
  g:  4192965  4192965      MSDOS                        # (Cyl. 4159*- 8319*)
dimension# disklabel -r wd0
disklabel: no disklabel
dimension#
----- cut here -----

Saying "disklabel wd1" (where NetBSD is on) just shows disklabels
a-e (/, swap, NetBSD partition, entire disk, /usr). "disklabel -r
wd1" shows exactly the same as without the -r option.

----- cut here -----
dimension# disklabel wd1
# /dev/rwd1d:
type: unknown
disk: mydisk
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 90069840
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0       # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize   cpg]
  a:   614400 81947565     4.2BSD     1024  8192    16   # (Cyl. 81297*- 81906*)
  b:   614400 82561965       swap                        # (Cyl. 81906*- 82516*)
  c:  8122275 81947565     unused        0     0         # (Cyl. 81297*- 89354)
  d: 90069840        0     unused        0     0         # (Cyl.    0 - 89354)
  e:  6893475 83176365     4.2BSD     1024  8192    16   # (Cyl. 82516*- 89354)
dimension# disklabel wd1
# /dev/rwd1d:
type: unknown
disk: mydisk
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 90069840
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0       # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize   cpg]
  a:   614400 81947565     4.2BSD     1024  8192    16   # (Cyl. 81297*- 81906*)
  b:   614400 82561965       swap                        # (Cyl. 81906*- 82516*)
  c:  8122275 81947565     unused        0     0         # (Cyl. 81297*- 89354)
  d: 90069840        0     unused        0     0         # (Cyl.    0 - 89354)
  e:  6893475 83176365     4.2BSD     1024  8192    16   # (Cyl. 82516*- 89354)
dimension# disklabel wd1
----- cut here -----

When I say "mbrlabel wd1", I mess up the a-e assignments above. NetBSD
becomes unuseable. Saying "mbrlabel wd0" produces new labels for wd0
(e becomes a, f becomes c and g becomes b). However this setup is not
saved. It doesn't survive a reboot. If I would like to keep these
settings, how should I do that and where is this stuff saved (inside
the MBR or inside a NetBSD filesystem)?

Another point reagrding mbrlabel. mbrlabel(8) says that the inside of
extended partitions is also analysed, hence logical partitions would
be found. This doesn't seem to be true (at least on my system).

> In the past I've run into problems for disks which don't have NetBSD
> partitions.  Since there is no NetBSD partition, there is no place
> for a disklabel.

Does this mean that the disklabels can only be saved for the disk
where NetBSD is on. To my understanding, NetBSD could also save
disklabels of disks not containing NetBSD. I might be completely wrong
here. Please correct me.

> The kernel will generate a fake disklabel, but
> (last time I checked - which was probably a long time ago) it won't
> include extended partitions.

On my system, it includes extended partitions, but no logical
partitions inside the extended partitions.

> I have worked around this problem by
> converting any extended partitions to primary partitions by using
> fdisk to add the appropriate entries to the main MBR partition
> table.  The DOS kernel (not sure about NT,2K,etc.) doesn't seem to
> mind.  Of course, you can only do this if you have a total of <= 4
> partitions -

This doesn't work for me since I have more to mount.

> which can be tricky if you've Linux on the same
> drive...  Ideally the fake-label generating code should examine
> extended partitions also.  Its been so long since I've had an
> extended partition, maybe it does now - I don't know...

> Rick

> On 27 Oct 2001, Georges Heinesch wrote:

>> Date: 27 Oct 2001 6:10:18 +0100
>> From: Georges Heinesch <geohei-ml@geohei.lu>
>> To: port-i386@netbsd.org
>> Subject: Mount logical drive inside extended partition
>>
>> The NetBSD/i386 FAQs don't consider the mounting of logical drives
>> inside extended partitions (only primary partitions).
>>
>> How can I define a label for logical dirves inside extended
>> partitions? The source of the size/offset is not the problem
>> (Partition Magic), but how I tell NetBSD to assign a letter to
>> these logical drives.
>>
>> I tried different approaches after a search for this subject on the
>> NetBSD site, but none was succeful. Syaing mbrlabel even messed up
>> my system to such an extend that a reboot was necessary.
>>
>> Any help would be appriciated!
>>
>> --
>> Cu  Georges Heinesch, Luxembourg
>>     geohei@geohei.lu
>>     http://www.geohei.lu
>>     PGP RSA & DH/DSS public key on request and on public servers
>>
>> ... N49.34.09 E006.09.01