Subject: Re: Partition minor numbers
To: Daniel Carosone <dan@geek.com.au>
From: Bill Studenmund <skippy@macro.stanford.edu>
List: current-users
Date: 01/09/1997 18:07:58
On Fri, 10 Jan 1997, Daniel Carosone wrote:

> 
> > Date: Thu, 9 Jan 1997 10:37:12 -0800 (PST)
> > From: Bill Studenmund <skippy@macro.stanford.edu>
> > 
> > As an aside, I though of a solution to the latter problem (partition
> > count). If we pick a special device type, and a special name (say SCSI
> > hard disks), we can glean the partition #'s at boot. The special name is
> > the name of the first partition on the second unit. For SCSI, it's sd1a.
> > We boot up, and the kernel goes along quite happily. At one point in boot,
> > it goes out and looks at /dev/special_name (/dev/sd1a here). If it doesn't
> > find it, the kernel can print an error about a missing device (did we
> > build devices this install?), and go with a default value. If it finds the
> > device, it can learn the # of partitions, and change things accordingly.
> > The thought is that at this point, there's only one dev_t pointing to mass
> > storage (assuming hard disk boot), root_device. If it's an hd, just
> > re-compute it. Then change a global setting the # of partitions in use.
> 
> Maybe I'm misunderstanding what you're suggesting, I'd sure hope that
> it doesn't restrict me from repartitioning and adding new partitions
> on a disk while the system is running.

No. The global is the max number of partitions/drive, not the number in
use. Right now, it's set at 8 on most ports. Many folks would like to go
to 16 or 32. The idea is that by looking at /dev, we can have one kernel
binary switch between 8, 16, or 32 partitions/drive. You'd have to play
with disklabel to actually allocate space for these extra partitions.

To switch, take the system down to single user, unmount everything, and
then re-make the device special files for hard disks. As the kernel's
concept of the max # of partitions won't change until next boot, and /'s
mount point is a block device which makes sense in the booted scheme, you
can pull this trick off. Just don't do anything which opens any of the
hard disk special files between the change and the reboot. Or boot off a
ramdisk or /altroot.

There's an additional problem with supporting 32 partitions/drive as the
disklabel'd then be over one 512-byte block long.

Take care,

Bill