Subject: Re: Some questions about disklabeling.
To: Ib-Michael Martinsen <imm@nethotel.dk>
From: Malcolm Herbert <mjch@mjch.net>
List: port-i386
Date: 03/31/2002 00:53:01
On Sat, 30 Mar 2002 08:49:15 +0100, "Ib-Michael Martinsen"
<imm@nethotel.dk> said:
|Frederick Bruckman writes:
| > Right. Consider the case where you have several extended
partitions,
| > all MSDOS, but no NetBSD partition. The kernel can't tell from the
| > MBR where the extended partition are, and you can't easily tell
| > it, because there's nowhere to write the label. I thought you said
| > you actually did what Todd suggested may be possible -- created a
| > disktab entry, and used that to mount partitions. It would be great
| > if you could.
|
|You are probably right. But I don't know the details of the MBR layout
|so I can not really comment on these matters. It just seems to me
|that if it is possible for Windows to figure out which partitions are
|primary and extended then it surely must also be possible for NetBSD?

I thought that the information about the partitions in an extended
partition was saved at the head of the extended partition somewhere,
in a table with exactly the same function as the whole-drive partition
table ... if that's the case, why shouldn't NetBSD use the traditional
'the same solution for similar problem' approach and treat the extended
partition as a virtual drive, which contains a 'disklabel' (ie. the
extended partition table) ... that way all you'd have to worry about
would be a small piece of code to mangle the extended partition table
into an in-core disklabel and you could then use all your normal tools
to deal with the new drive without having to worry about absolute disk
layout for partitions and so on ... seems to me (from what I've seen of
NetBSD so far) that that would fit in better with the whole philosophy

here's a conversation I had with a netbsd-enabled friend of mine. Some
context: I'd asked him how to mount a partition from within an extended
partition, since I couldn't find it with disklabel - my previous
question had been about how to mount a cd9660 disk image and he'd shown
me vnconfig ... hence the following:

|Message 24: Mon Mar 4 12:50:19 (read)
|From: grant [To: drol]
|re ext partition. I think this is an FAQ - you need to edit the BSD
|disklabel and create a slice on the disk which points to the start of
|the logical drive inside the extended partition. I believe the offset
|is 63 sectors from the start of the extended partition, but I can't
|remember for sure.
|
|If you have more than one logical drive in the ext partition, you need
|to create separate disklabel entries for each
|
|Message 7: Mon Mar 4 13:06:19 (read)
|From: drol [To: grant]
|urgh ... messy
|
|OK, thanks ...
|
|Message 25: Mon Mar 4 13:06:29 (read)
|From: grant [To: drol]
|the DOS partition table _is_ messy!
|
|Message 10: Mon Mar 4 17:49:11 (read)
|From: grant [To: drol]
|luke may have been working on something that makes it easier to deal
|with but I guess all you really need is a program which understands
the
|dos partition table (eg. linux fdisk) and use the figures it spits out
|in your BSD disklabel
|
|Message 4: Mon Mar 4 21:52:45 (read)
|From: drol [To: grant]
|hmmm ... thinking about the way virtual devices are managed ...
|wouldn't it be simpler to treat an extended partition like it was
|another virtual device with its own table inside it (which is
|effectively what it is already) ... then you might have something like
|/dev/wd0d is treated as a _virtual_ drive with a device (say)
/dev/vnd0
|which has its own virtual disklabel ... then you'd be managing devices
|in exactly the same way as you do for filesystem-within-file devices
|
|Message 3: Mon Mar 4 21:53:35 (read)
|From: drol [To: grant]
|... then you don't have to worry about providing disklabels for each
|extended partition (which is the interpretation I put on what you
|goofed me before - I could be wrong though)
|
|Message 9: Tue Mar 5 08:15:13 (read)
|From: grant [To: drol]
|you don't have a disklabel per partition, disklabel is just per disk
|- you jneed to create a disklabel _slice_ per chunk of disk you want
|access to. you may need three disklabel slices for one extended
|partition if it has multiple logical drives...
|
|Message 2: Tue Mar 5 10:51:30 (read)
|From: drol [To: grant]
|ahh ... that makes more sense ... but still, if you had a virtual
|device that was capable of reading the extended partition's partition
|table you wouldn't need to muck around with absolute disk positions,
|you could treat it just like a normal disk ... I think that's a much
|better solution, imho ...
|
|Message 1: Tue Mar 5 10:52:53 (read)
|From: drol [To: grant]
|... mind if I forward this to luke?
|
|Message 1: Tue Mar 5 11:36:22 (read)
|From: grant [To: drol]
|go for it...



-- 
Malcolm Herbert                                This brain intentionally
mjch@mjch.net                                                left blank