[nycbug-talk] OpenBSD, numbering disks...

George Georgalis george
Sun Jul 24 22:29:03 EDT 2005


On Fri, Jul 22, 2005 at 06:49:47PM -0400, bruno wrote:
>On Fri, Jul 22, 2005 at 06:22:52PM -0400, George Georgalis wrote:
>> On Tue, Jul 19, 2005 at 09:16:48AM -0400, bruno wrote:
>> >On Tue, Jul 19, 2005 at 09:01:01AM -0400, George Georgalis wrote:
>> >> On Tue, Jul 19, 2005 at 01:46:46AM -0400, Jesse Callaway wrote:
>> >> >On Monday 18 July 2005 11:59 pm, George Georgalis says:
>> >> >> What's the best way to assure my root ata disk doesn't get renumbered,
>> >> >> when new sata drives are added?
>> >> >>
>> >> >
>> >> >There isn't one. The number will get bumped. Not when you're running, but if 
>> >> >you reboot. So I'm assuming this is only a problem when rebooting. Maybe you 
>> >> 
>> >> 
>> >> The thing is, BIOS doesn't number them differently, ata is always
>> >> first, then sata drives (there is no sata/pata in bios boot order, just
>> >> hd-0,1,2,3,4...), it is the OS renumbering the drives, so I imagine it
>> >> could be programmed or configured to do "the thing I expect" -- whether
>> >> that is right or not.
>> >> 
>> >> dkcsum: wd0 matched BIOS disk 81
>> >> dkcsum: wd1 matched BIOS disk 80
>> >> 
>> >> I think the only thing required is a "configuration" to make BIOS 0x80
>> >> always map to wd0. 
>> >
>> >You can probably do this with a kernel config file.
>> 
>> I've been looking but can't find anything like this, only go there if
>> you know exactly what you are doing, type statements.
>
>Something like this, in GENERIC (OpenBSD):
>
># IDE hard drives
>wd*     at wdc? channel ? drive ? flags 0x0000
>wd*     at pciide? channel ? drive ? flags 0x0000
>
>You can perhaps hardcode to what you want:
>
>wd0	at pciide0 channel 0 drive 0 flags 0x0000
>wd1	at .......
>
>If you hardcode all your drives, including ones you add/remove, maybe
>there is a chance your devices would always stay the same.
>Assuming this works at all, and/or works with IDE.

I'm going to give this a try, it's my best shot. Here's some a rehash
from my misc at openbsd post...

On Fri, Jul 22, 2005 at 07:05:46AM +0100, Peter Galbavy wrote:
>George Georgalis wrote:
>
>>Is there a way to rectify the renaming? eg "set BIOS_0x80 = wd0" I want
>>to keep my root on ATA, but frequently add and remove storage drives
>>from a 4 high sata carrier.
>> 
>>
>Custom kernel. I have done this on one of mine for the opposite reason, 
>I wanted the SATA drive to be wd0 while normal BIOS / PCI mapping makes 
>it appear as wd2. I do not have the same hardware, obviously. I cannot 
>get a cut'n'paste at the moment as the machine is off and I am on the 
>way out to work. This makes your system difficult to support, only 
>consider it if you are comfortable.

If you could send that over I'd much appreciate it. On my system,
I'm pretty sure the kernel is numbering the wd* disks on its own,
irrespective of BIOS. On one occasion I got the kernel from the disk on
the on-board sata controller, which then proceeded to mount "wd0" which
OBSD 3.7 assigned as the disk on the pci sata controller. Yep, my DFLY
root fs on an auxiliary sata disk was mounted rw on top of the OBSD ro
root partition that was used to boot, I was even able to log in and run
a few commands before it locked up hard.

It seems the GENERIC disk numbering is exactly opposite of what one
would hope for when adding disks to a system. Regardless of what bios
boots, the kernel numbers pata and sata controllers in this order (I
don't have any aux pata controllers to try)

 pci controller(s) (furthest from the cpu)
 on-board sata
 on-board pata

So there is pretty much no way to add a disk to a system without
renumbering all the disks (you would have to have all the controllers
installed before hand and start with a root on channel 0 of the
controller furthest from the cpu, with additional disks being added
toward the on-board pata in the list above.

I cannot think of a downside of numbering them in the opposite
direction (other than breaking systems that are in place).

For this particular host, I definitely need to get this fixed, as I
have a 4 high sata disk carrier that is intended for use as auxiliary
(frequently changed) disk storage, with the pci/on-board sata controllers.

On another list I got some recommendations for kernel configs, but I've
not had a chance to try them yet. I'm pretty green with *BSD, though
expert with Linux

http://lists.nycbug.org/pipermail/talk/2005-July/006172.html
 You want to change that to something like:

        config bsd root on sd0a swap on sd0b dumps on sd0b

 and then rebuild your kernel.  You might even want to build one for sd0
 and one for sd1, so if a new SATA disk appears as sd0, you can still
 boot from the normal drive.

...I don't think that will work, ie it will be easier to just change
fstab each time I add or remove a disk.

http://lists.nycbug.org/pipermail/talk/2005-July/006173.html
 You can perhaps hardcode to what you want:
 
 wd0	at pciide0 channel 0 drive 0 flags 0x0000
 wd1	at .......
 
 If you hardcode all your drives, including ones you add/remove, maybe
 there is a chance your devices would always stay the same.

...this will take me a day of toying with once I'm able to try it
out, I'm not sure if "pciide0" is named by BIOS or the kernel, in this
context, if that's a bios 0x80 I think it could work.

the thread starts here, with a lot more details
http://lists.nycbug.org/pipermail/talk/2005-July/006123.html

I really wanted to use mount point /mnt/c{0,1}c{0,1} for on-board/aux
sata Controler, Channel 0/1, with OS installed on primary pata channel
and cdrom on secondary pata.

I have the sense there is a way to use GENERIC, somehow I just need to
tell the kernel the BIOS disk 0x80 is wd0, 0x81 is wd1, 0x82 is wd2 and
so fourth, not the other way around. Maybe "wd0 at pciide0 ..." above is
the easiest way.

// George


-- 
George Georgalis, systems architect, administrator <IXOYE><
http://galis.org/ cell:646-331-2027 mailto:george at galis.org




More information about the talk mailing list