Re: forcing system disk to wd0

2008-09-12 Thread Anathae Townsend
My two cents (your mileage etc.) Having the system disk "just work (tm)" is
a good thing. Having it work in a secure and correct way seems like
something not so trivial. Perhaps linking at least root to the system disk
could be set as a boot option.

A combination of a uuid, boot options, and mount using these two perhaps? 



Re: forcing system disk to wd0

2008-09-12 Thread Vadim Zhukov
12 September 2008 c. 21:13:55 Nick Guenther wrote:
> On Thu, Sep 11, 2008 at 8:52 AM, Joseph A Borg <[EMAIL PROTECTED]> wrote:
> > but i'll have to change it every time i add or remove a hard
> > diskwhich can be pretty frequent.
> >
> > if the total number of drives in the system is not the same from
> > boot to boot, i have to tweak fstab.
> > is it possible for a future update of OpenBSD to tweak fstab to take
> > references to the boot drive? that should help a lot in such cases.
> > I could spout a lot of ideas, like having a unique identifier
> > (combination of timestamp and netcard/cpu id?) in the boot block for
> > reference in fstab, but i'm no expert.
>
> Maybe a stupid idea: Could you hack /etc/rc to add a tiny script that
> reads the last line of dmesg to find where the root disk is and then
> rewrites fstab dynamically before `mount -a` gets run? I have OpenBSD
> on a thumbdrive that will be sd0 typically unless there are other
> thumbdrives/SATA drives plugged into the system I happen to be booting
> on and so I considered this but wasn't bold enough to edit rc

I thought of adding new sysctl(s) like "hw.rooton", even started to hack
but had to stop due to lack of time. :( It should be simple enough IMHO,
though.

--
  Best wishes,
Vadim Zhukov



Re: forcing system disk to wd0

2008-09-12 Thread Ted Unangst
On Thu, Sep 11, 2008 at 8:52 AM, Joseph A Borg <[EMAIL PROTECTED]> wrote:
> if the total number of drives in the system is not the same from boot
> to boot, i have to tweak fstab.
> is it possible for a future update of OpenBSD to tweak fstab to take
> references to the boot drive? that should help a lot in such cases. I
> could spout a lot of ideas, like having a unique identifier
> (combination of timestamp and netcard/cpu id?) in the boot block for
> reference in fstab, but i'm no expert.

The superblock for each filesystem does contain space for labels, it's
just that mount doesn't look at them.  If somebody added some "put my
drives back where they were last time" code, it wouldn't be too hard.



Re: forcing system disk to wd0

2008-09-12 Thread Nick Guenther
On Thu, Sep 11, 2008 at 8:52 AM, Joseph A Borg <[EMAIL PROTECTED]> wrote:
> but i'll have to change it every time i add or remove a hard diskwhich can
> be pretty frequent.
>
> if the total number of drives in the system is not the same from boot
> to boot, i have to tweak fstab.
> is it possible for a future update of OpenBSD to tweak fstab to take
> references to the boot drive? that should help a lot in such cases. I
> could spout a lot of ideas, like having a unique identifier
> (combination of timestamp and netcard/cpu id?) in the boot block for
> reference in fstab, but i'm no expert.

Maybe a stupid idea: Could you hack /etc/rc to add a tiny script that
reads the last line of dmesg to find where the root disk is and then
rewrites fstab dynamically before `mount -a` gets run? I have OpenBSD
on a thumbdrive that will be sd0 typically unless there are other
thumbdrives/SATA drives plugged into the system I happen to be booting
on and so I considered this but wasn't bold enough to edit rc

-Nick



Re: forcing system disk to wd0

2008-09-11 Thread Joseph A Borg

the kernel is absolutely something i wouldn't touch, unless it's a
well documented and easy to follow tweak
but thanks for all the detailed info.


On Sep 11, 2008, at 19:01, Philip Guenther wrote:


On Thu, Sep 11, 2008 at 5:52 AM, Joseph A Borg <[EMAIL PROTECTED]>
wrote:

but i'll have to change it every time i add or remove a hard
diskwhich can
be pretty frequent.


Ah, so there's the rest of the problem description.  (You didn't
initially why the assignments were an issue, so the assumption was
that it was an aesthetic matter.  That may sound silly, but people
worry about the silliest things.)


It's possible to hardcode the assignment of drives in the kernel
config.  I _think_ this can only be done by compiling a new kernel
completely (i.e., I don't think "config -e" can do it).

(I used to do this for my laptop, so that the main harddrive would
always be wd0, whether or not I had a second drive in the removable
bay.  I stopped when ahci support was added, as then the main drive
became sd0 always.)

Basically, you look at the dmesg to see what the chain of devices to
the one you want to hardcode is and then you add explicit lines for
those to your kernel config as special cases.  In my case, IIRC, I
added lines that ran something like:
  pciide1 at pci0 dev 31 something something something
  wd0 at pciide1 flags 0x

(My memory says that specifying the involve pciide channel as pciide0
didn't work right; the assignments didn't always occur the way I
expected or something.  Forcing it to be pciide1 worked, and then I
could always set wd0 to be the drive on that channel.)

Note: don't alter the GENERIC config.  Create a new file that uses
'include' to pull in GENERIC and then follows it with your required
lines.

Of course, compiling your own kernel is taking you out of normal,
supported territory.  You'll need to decide whether that's worth the
trade-off.  If you aren't comfortable supporting your custom kernel
config, then don't, and use your existing best practices to avoid the
problem.  Don't forget to keep an original GENERIC kernel on hand for
confirming and reporting problems.


Philip Guenther




Re: forcing system disk to wd0

2008-09-11 Thread Joseph A Borg

hi marco
no problemo, and thanks for the prompt replies. I'm just projecting
possibilities, trying to make it work for me. yet I'd like to avoid
looking for info that doesn't exist, which ironically takes the
longest to look for.

On Sep 11, 2008, at 19:19, Marco Peereboom wrote:


Why would you be adding removing drives all the time?


I plan to do a simple dump backup on a rotating set of HDs each
evening. Am I safe to assume that sata drives can be added after boot
with no loss in system integrity?




I have storage stuff for a living and this isn't hardly an issue to
me.
I promise you I change and replace a lot of disk too.

Is it possible to add a short entry in the official website's FAQ,
maybe under 'disk set up' or 'system management'?
I'm not good enough to write anything remotely technical unfortunately
and y experience is very lacking - to put it mildly.
With the reduced costs in having multiple drives, I'm sure it's
becoming a common issue for many.



Several things have been discussed in auto-detecting these drive
changes
but none are acceptable or too cumbersome.  Consider this a WIP.

so i didn't think of it first :-)
i guess as a first step you'd need to tackle the simplest of
scenarios: only add drives with an MBR and a system containing the
minimum required partitions so that the boot process can continue, but
I can see a lot of issues cropping up even with my rudimentary
understanding

keep up the good work!



On Thu, Sep 11, 2008 at 02:51:27PM +0200, Joseph A Borg wrote:

but i'll have to change it every time i add or remove a hard disk?
which
can be pretty frequent.

if the total number of drives in the system is not the same from
boot to
boot, i have to tweak fstab.
is it possible for a future update of OpenBSD to tweak fstab to take
references to the boot drive? that should help a lot in such cases. I
could spout a lot of ideas, like having a unique identifier
(combination
of timestamp and netcard/cpu id?) in the boot block for reference in
fstab, but i'm no expert.

Oh well i'll resign to your suggestions and follow a strict
workflow: no
superfluous drives at boot and add them just before backup should do
fine, unless anybody has a better idea. I'd hate keeping back-up
drives
in the machine for no apparent reason.

At least i don't have to spend more time searching for info as this
seems to be a dead end.

thanks for the feedback all round

regards


On Sep 11, 2008, at 13:53, Marco Peereboom wrote:


Right, assuming you don't have to change your boot device in BIOS
all
you have to do is do it in fstab.

On Thu, Sep 11, 2008 at 01:04:19PM +0200, Otto Moerbeek wrote:

On Thu, Sep 11, 2008 at 09:40:47AM +0200, Joseph A Borg wrote:


I just added a 4 port promise sata card and cannot figure a way of
forcing the sata ports on the motherboard to take precedence over
the
sata pci card.


why? It's just a number.



Any pointers to useful info would be greatly appreciated. I guess
i'll
have to mess with the BIOS and IRQs but these are, till now out of
my
radar.

regards


Better not mess at all. Fix your fstab and all's well.

-Otto




Re: forcing system disk to wd0

2008-09-11 Thread Tom Rosso
I'm mildly interested in this issue.  I had a system a while back where 
my root fs drive was plugged into the mobo's sata port, but I had a PCI 
sata card with a bunch of other drives on it.  I only ran Linux on it 
(hate to muddy the waters by bring up Linux).  Sometimes the root drive 
would be "sda1" and sometimes the first drive on the PCI sata card would 
be sda1, causing the root drive to get pushed to sde1.  However, on 
Linux, when you create a file system, it assigns that file system a UUID 
which never changes, and which can be referenced in fstab, essentially 
eliminating the problem of which drive gets initialized first.


I've never had this issue with OpenBSD because I haven't used it as a 
file server (yet).  I know this initialization order issue comes up 
somewhat frequently on the misc mailing list, but usually the issue is 
merely "I added a drive and am too lazy to edit fstab."  Not being a 
developer, I'm wondering if anybody has considered creating a feature 
similar to the one that exists in Linux, or if there's a reason why that 
feature shouldn't be added, or if it is merely not enough of a problem 
for anybody to get to it yet.


Tom


Joseph A Borg wrote:
I just added a 4 port promise sata card and cannot figure a way of 
forcing the sata ports on the motherboard to take precedence over the 
sata pci card.


Any pointers to useful info would be greatly appreciated. I guess i'll 
have to mess with the BIOS and IRQs but these are, till now out of my 
radar.


regards




Re: forcing system disk to wd0

2008-09-11 Thread Philip Guenther
On Thu, Sep 11, 2008 at 5:52 AM, Joseph A Borg <[EMAIL PROTECTED]> wrote:
> but i'll have to change it every time i add or remove a hard diskwhich can
> be pretty frequent.

Ah, so there's the rest of the problem description.  (You didn't
initially why the assignments were an issue, so the assumption was
that it was an aesthetic matter.  That may sound silly, but people
worry about the silliest things.)


It's possible to hardcode the assignment of drives in the kernel
config.  I _think_ this can only be done by compiling a new kernel
completely (i.e., I don't think "config -e" can do it).

(I used to do this for my laptop, so that the main harddrive would
always be wd0, whether or not I had a second drive in the removable
bay.  I stopped when ahci support was added, as then the main drive
became sd0 always.)

Basically, you look at the dmesg to see what the chain of devices to
the one you want to hardcode is and then you add explicit lines for
those to your kernel config as special cases.  In my case, IIRC, I
added lines that ran something like:
   pciide1 at pci0 dev 31 something something something
   wd0 at pciide1 flags 0x

(My memory says that specifying the involve pciide channel as pciide0
didn't work right; the assignments didn't always occur the way I
expected or something.  Forcing it to be pciide1 worked, and then I
could always set wd0 to be the drive on that channel.)

Note: don't alter the GENERIC config.  Create a new file that uses
'include' to pull in GENERIC and then follows it with your required
lines.

Of course, compiling your own kernel is taking you out of normal,
supported territory.  You'll need to decide whether that's worth the
trade-off.  If you aren't comfortable supporting your custom kernel
config, then don't, and use your existing best practices to avoid the
problem.  Don't forget to keep an original GENERIC kernel on hand for
confirming and reporting problems.


Philip Guenther



Re: forcing system disk to wd0

2008-09-11 Thread Joseph A Borg

but i'll have to change it every time i add or remove a hard disk
which can be pretty frequent.

if the total number of drives in the system is not the same from boot
to boot, i have to tweak fstab.
is it possible for a future update of OpenBSD to tweak fstab to take
references to the boot drive? that should help a lot in such cases. I
could spout a lot of ideas, like having a unique identifier
(combination of timestamp and netcard/cpu id?) in the boot block for
reference in fstab, but i'm no expert.

Oh well i'll resign to your suggestions and follow a strict workflow:
no superfluous drives at boot and add them just before backup should
do fine, unless anybody has a better idea. I'd hate keeping back-up
drives in the machine for no apparent reason.

At least i don't have to spend more time searching for info as this
seems to be a dead end.

thanks for the feedback all round

regards


On Sep 11, 2008, at 13:53, Marco Peereboom wrote:


Right, assuming you don't have to change your boot device in BIOS all
you have to do is do it in fstab.

On Thu, Sep 11, 2008 at 01:04:19PM +0200, Otto Moerbeek wrote:

On Thu, Sep 11, 2008 at 09:40:47AM +0200, Joseph A Borg wrote:


I just added a 4 port promise sata card and cannot figure a way of
forcing the sata ports on the motherboard to take precedence over
the
sata pci card.


why? It's just a number.



Any pointers to useful info would be greatly appreciated. I guess
i'll
have to mess with the BIOS and IRQs but these are, till now out of
my
radar.

regards


Better not mess at all. Fix your fstab and all's well.

-Otto




Re: forcing system disk to wd0

2008-09-11 Thread Stuart Henderson
On 2008-09-11, Joseph A Borg <[EMAIL PROTECTED]> wrote:
> I just added a 4 port promise sata card and cannot figure a way of  
> forcing the sata ports on the motherboard to take precedence over the  
> sata pci card.

You may get lucky by moving it to a different slot. Or you may not.



Re: forcing system disk to wd0

2008-09-11 Thread Joseph A Borg
my problem is that i have just purchased two hot-swap cages. One puts  
2 laptop drives in a 3.5" bay that will be used to back up daily work  
on a roster of 5 disks, the other is consists of 3 regular hard drives  
in the space of 2x5.25" bays and currently houses the system hd,  the  
projects hd and a spare.


The hd configuration WILL change between re-boots and the fstab will  
be wrong most of the time as the boot drive comes after the SATA card.  
I can set the boot drive at start up from the BIOS but fstab stops the  
system from booting. If there's a way of abstracting out the hard  
device references in fstab I'm happy.


regards

On Sep 11, 2008, at 13:10, Peter Kay - Syllopsium wrote:


From: "Joseph A Borg" <[EMAIL PROTECTED]>
Subject: forcing system disk to wd0
I just added a 4 port promise sata card and cannot figure a way of   
forcing the sata ports on the motherboard to take precedence over  
the  sata pci card.


Any pointers to useful info would be greatly appreciated. I guess  
i'll have to mess with the BIOS and IRQs but these are, till now  
out of my radar.
You can't force a computer to do something the BIOS doesn't want it  
to do. The booting process uses only the devices the BIOS, and addon  
cards' BIOS control, in varying orders.


In other words, you're going to have to put a bootstrap on a device  
that's in the booting sequence, even if it's not the final location  
of /. It could be another hard disk, a flash drive - even a suitably  
configured cdrom or floppy should work. A boot manager would  
probably be easier and more flexible than configuring OpenBSD to  
bootstrap off one device, and finish booting off another.


PK




Re: forcing system disk to wd0

2008-09-11 Thread Marco Peereboom
Right, assuming you don't have to change your boot device in BIOS all
you have to do is do it in fstab.

On Thu, Sep 11, 2008 at 01:04:19PM +0200, Otto Moerbeek wrote:
> On Thu, Sep 11, 2008 at 09:40:47AM +0200, Joseph A Borg wrote:
> 
> > I just added a 4 port promise sata card and cannot figure a way of  
> > forcing the sata ports on the motherboard to take precedence over the  
> > sata pci card.
> 
> why? It's just a number.
> 
> >
> > Any pointers to useful info would be greatly appreciated. I guess i'll  
> > have to mess with the BIOS and IRQs but these are, till now out of my  
> > radar.
> >
> > regards
> 
> Better not mess at all. Fix your fstab and all's well.
> 
>   -Otto



Re: forcing system disk to wd0

2008-09-11 Thread Otto Moerbeek
On Thu, Sep 11, 2008 at 09:40:47AM +0200, Joseph A Borg wrote:

> I just added a 4 port promise sata card and cannot figure a way of  
> forcing the sata ports on the motherboard to take precedence over the  
> sata pci card.

why? It's just a number.

>
> Any pointers to useful info would be greatly appreciated. I guess i'll  
> have to mess with the BIOS and IRQs but these are, till now out of my  
> radar.
>
> regards

Better not mess at all. Fix your fstab and all's well.

-Otto



forcing system disk to wd0

2008-09-11 Thread Joseph A Borg
I just added a 4 port promise sata card and cannot figure a way of  
forcing the sata ports on the motherboard to take precedence over the  
sata pci card.


Any pointers to useful info would be greatly appreciated. I guess i'll  
have to mess with the BIOS and IRQs but these are, till now out of my  
radar.


regards