Subject: Re: Indirect file system mount
To: None <tech-kern@netbsd.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: tech-kern
Date: 03/02/2004 14:07:07
On Tuesday 02 March 2004 13:18, der Mouse wrote:
> > Well, IMHO the problem is obvious - when i remove wd0 or wd1 disk
> > from my PC, the order of detected IDE disks is shifted so i do not
> > have anymore for example /dev/wd1a as system root course now it's
> > located on /dev/wd0a.  So every time i need to fix /etc/fstab
> > manually when something's changed.
>
> The usual approach to this is to build a kernel with a slightly
> different config.  Exactly what the changes will be depends on where
> your disks are attached.
>
> You don't say which port you're using.  You do mention having NTFS,
> FAT32, and Linux on the disks, which if I'm not mistaken means either
> i386 or alpha (AFAIK nothing else runs NT, NetBSD, and Linux), most
> probably i386.  (People running alphas tend to mention that they're
> using alphas; also, there are probably more i386 machines out there
> than any other single port, possibly even more than all other ports put
> together.)

Sorry, of course i should mention it :)

NetBSD ianzag 1.6.1 NetBSD 1.6.1 (Ianzag) #1: Mon Mar  1 19:13:37 NOVT 2004     
ianzag@ianzag:/usr/src/sys/arch/i386/compile/Ianzag i386

so all machines are i386.

> I would guess the commonest case these days is that your disks attach
> at pciide, as indicated by boot-time messages like
>
> 	wd0 at pciide0 channel 0 drive 0: <MAXTOR 6L040J2>
>
> 	wd1 at pciide0 channel 0 drive 1: <IBM-DPTA-372730>

For my current workstation dmesg output looks like:

---cut---
pciide0 at pci0 dev 31 function 1: Intel 82801DB IDE Controller (ICH4) (rev. 
0x01)
pciide0: bus-master DMA support present
pciide0: primary channel wired to compatibility mode
wd0 at pciide0 channel 0 drive 0: <IC35L060AVER07-0>
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 58644 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 120103200 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd1 at pciide0 channel 0 drive 1: <Maxtor 2B010H1>
wd1: drive supports 16-sector PIO transfers, LBA addressing
wd1: 9771 MB, 16383 cyl, 16 head, 63 sec, 512 bytes/sect x 20012832 sectors
wd1: 32-bit data port
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
pciide0: primary channel interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA 
data transfers)
wd1(pciide0:0:1): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA 
data transfers)
pciide0: secondary channel wired to compatibility mode
atapibus0 at pciide0 channel 1: 2 targets
cd0 at atapibus0 drive 1: <ASUS CD-S500/A, , V1.4D> type 5 cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
pciide0: secondary channel interrupting at irq 15
cd0(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA 
data transfers)
---cut---

> In that case, edit your kernel config to add lines
>
> 	wd0 at pciide0 channel 0 drive 0
> 	wd1 at pciide0 channel 0 drive 1
> 	wd2 at pciide0 channel 1 drive 0
> 	wd3 at pciide0 channel 1 drive 1
>
> (or whatever the actual locations are) and all four wd disks will be
> nailed down - for example, if you pull wd1, wd2 and wd3 will not
> magically get renamed to wd1 and wd2; instead, wd1 simply won't exist.
>

Well, of course this is good sollution for my current static workstation but 
when i re-connect hard disk with installed NetBSD into some other machine, 
its configuration may differ :(

Most recently found problem is that other's machine already has hard disk 
connected to primary IDE controller as master and for example CD-ROM 
connected to secondary IDE controller as master or slave. So i do not have a 
lot of choice which IDE controller/channel to use. And that's not always 
possibly to re-configure other's machine :)

So the overal goal is to enable to mounti file systems regardless to the 
current location of my hard disk in IDE controller/channel space. Same's 
would be great for SCSI etc.

// wbr