* [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? @ 2006-08-04 4:14 Meino Christian Cramer 2006-08-04 9:19 ` Richard Fish 2006-08-04 10:10 ` Etaoin Shrdlu 0 siblings, 2 replies; 10+ messages in thread From: Meino Christian Cramer @ 2006-08-04 4:14 UTC (permalink / raw To: gentoo-user Hi, Trying to write some udev rules to map two identical (model wise) SATA-harddiscs to different entries in /dev/. got a question mark into my head: Both harddiscs are removeable and either the first or the second are inserted into my system. Both harddiscs are identical models and will have the same partitioning and formatting. Only the contents will differ. Currently they are "pure metal"... :) If inserted a /dev/sda is created I did a udevinfo -a -p /dev/sda and got different informations per bus type. Under BUS="scsi" there is a model name, which normally is used for entries of the udev.rules files. But: How can I distinguish both harddiscs? The entries under BUS="pci" do mention: looking at device '/devices/pci0000:00/0000:00:0f.0': ID=="0000:00:0f.0" BUS=="pci" DRIVER=="sata_via" SYSFS{modalias}=="pci:v00001106d00003149sv00001043sd000080EDbc01sc04i00" SYSFS{local_cpus}=="3" SYSFS{irq}=="18" SYSFS{class}=="0x010400" SYSFS{subsystem_device}=="0x80ed" SYSFS{subsystem_vendor}=="0x1043" SYSFS{device}=="0x3149" SYSFS{vendor}=="0x1106" ...but this is another bus type for the same entry.... How can I identify both harddiscs individually ? Thank you very much for any help in advance ! mcc -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 4:14 [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Meino Christian Cramer @ 2006-08-04 9:19 ` Richard Fish 2006-08-04 9:39 ` Meino Christian Cramer 2006-08-04 10:10 ` Etaoin Shrdlu 1 sibling, 1 reply; 10+ messages in thread From: Richard Fish @ 2006-08-04 9:19 UTC (permalink / raw To: gentoo-user On 8/3/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > Hi, > > Trying to write some udev rules to map two identical (model wise) > SATA-harddiscs to different entries in /dev/. got a question mark > into my head: I don't see any obvious way of doing this with udev. I have some identical USB drives that I use, and I can identify them by serial number, but this doesn't seem possible for SATA drives. Your best bet may be to mount filesystems by label, or use LVM to accomplish something similar. -Richard -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 9:19 ` Richard Fish @ 2006-08-04 9:39 ` Meino Christian Cramer 2006-08-04 17:43 ` Richard Fish 0 siblings, 1 reply; 10+ messages in thread From: Meino Christian Cramer @ 2006-08-04 9:39 UTC (permalink / raw To: gentoo-user From: "Richard Fish" <bigfish@asmallpond.org> Subject: Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Date: Fri, 4 Aug 2006 02:19:09 -0700 > On 8/3/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > > Hi, > > > > Trying to write some udev rules to map two identical (model wise) > > SATA-harddiscs to different entries in /dev/. got a question mark > > into my head: > > I don't see any obvious way of doing this with udev. I have some > identical USB drives that I use, and I can identify them by serial > number, but this doesn't seem possible for SATA drives. > > Your best bet may be to mount filesystems by label, or use LVM to > accomplish something similar. > > -Richard > -- > gentoo-user@gentoo.org mailing list > Hi Richard ! (if just a moment before a incomplete posting by me has arrived you and/or the list: SORRY! I pressed the wrong button accidentaly....) Is this logically/technically correct, Richard: ? - The BIOS recogizes the "first" disk (grub: hd0) only by the bus it is attached to: A disk connected to "SATA connector 1" will be hd0, and another one connected to "SATA connector 2" will be hd1 - Therefore grub can distinguish the disks and choose the correct one to boot from right from the BIOS settings and the bus ID even all disks attached to the system are physically and model-wise absolutely identical. - So, booting a kernel image from the correct disk will be no problem. - Now...I will label the root of my bootdisk (grub: hd0) with "root" (only as an example...) and pass that as kernelparameter: root="root" - The system will boot and find its root also. In the net it was mentioned that one has to configure the kernel to recognize partition labels...was this an old "featire" or what do I have to configure where? I searched through /proc/config.gz and found nothing appropiate as I found nothing in /usr/src/linux/Documentatio. Any idea ? Is this correct so far ? Leep booting !;) mcc -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 9:39 ` Meino Christian Cramer @ 2006-08-04 17:43 ` Richard Fish 0 siblings, 0 replies; 10+ messages in thread From: Richard Fish @ 2006-08-04 17:43 UTC (permalink / raw To: gentoo-user On 8/4/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > Is this logically/technically correct, Richard: ? > > - The BIOS recogizes the "first" disk (grub: hd0) only by the bus it > is attached to: A disk connected to "SATA connector 1" will be hd0, > and another one connected to "SATA connector 2" will be hd1 It is based on the BIOS boot order mapping. So if the BIOS is configured to boot connector 1 (c1) first, then c2, then yes, c2 will be hd1. But if you remove c1, then c2 will be the first bootable hard drive, and become hd0. > - Therefore grub can distinguish the disks and choose the correct one > to boot from right from the BIOS settings and the bus ID even all > disks attached to the system are physically and model-wise > absolutely identical. If both drives are permanently connected, then you only need to install grub on the first drive, and it can reference kernels and initrds from the second drive (hd1). But if you are going to remove the first one to boot from the second, or change the order of the drives, then you will want hd0 in the grub configuration for both drives. You can use device.map files to specify what the BIOS mapping will be when you boot from each drive. So for example if you wanted to install grub on /dev/sdb, and plan for it to become sda when you boot from it, you can have a device.map that contains: (hd0) /dev/sdb And install grub on that device with: echo << EOF | grub --device-map=device.map root (hd0,0) # assuming /boot is /dev/sdb1 setup (hd0) EOF > - So, booting a kernel image from the correct disk will be no > problem. > - Now...I will label the root of my bootdisk (grub: hd0) with "root" > (only as an example...) and pass that as kernelparameter: > > root="root" For my recovery disk, what I use is "root=LABEL=recovery". You also need an initramfs environment that uses the standard 'mount' command to mount the root filesystem, so that the mount-by-label trick actually works. Are you planning on removing one drive to boot from the other? Or keeping both drives permanently installed and using BIOS/grub to decide which drive to boot from? -Richard -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 4:14 [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Meino Christian Cramer 2006-08-04 9:19 ` Richard Fish @ 2006-08-04 10:10 ` Etaoin Shrdlu 2006-08-04 17:28 ` Richard Fish 1 sibling, 1 reply; 10+ messages in thread From: Etaoin Shrdlu @ 2006-08-04 10:10 UTC (permalink / raw To: gentoo-user On Friday 4 August 2006 06:14, Meino Christian Cramer wrote: > But: How can I distinguish both harddiscs? On one of my system, I run a raid 1 array with two identical disks (hde and hdg), and I have this (sorry for the line wraps): [Fri Aug 04 11:38:50 root@bach ~]# ls -l /dev/disk/by-id/ [cut] lrwxrwxrwx 1 root root 9 Jul 20 10:50 ata-Maxtor_6Y080L0_Y2CG9M5E -> ../../hde lrwxrwxrwx 1 root root 9 Jul 20 10:50 ata-Maxtor_6Y080L0_Y3J1HW3E -> ../../hdg Those device names DO include the disk's serial number, and are (I suppose) created by udev. So, just plug in each of your identical drives and look at the devices which udev creates. Once you identify the exact names (probably under /dev/disk/by-id), use those names to distinguish between the drives wherever you need to. The strange thing is that udev obviously knows the serial number of each drive (udevinfo -q all -n /dev/sda *DOES* show the device's serial number), but it seems that no file under /sys contains this information (for hard disks, at least), so it looks like it's not possible to use a regular udev rule to create different devices (but, as I said above, seems that udev is somehow able to do that by itself - if somebody has more info please tell). I could probably be missing something here. -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 10:10 ` Etaoin Shrdlu @ 2006-08-04 17:28 ` Richard Fish 2006-08-04 18:30 ` Meino Christian Cramer 0 siblings, 1 reply; 10+ messages in thread From: Richard Fish @ 2006-08-04 17:28 UTC (permalink / raw To: gentoo-user On 8/4/06, Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote: > [Fri Aug 04 11:38:50 root@bach ~]# ls -l /dev/disk/by-id/ > [cut] > lrwxrwxrwx 1 root root 9 Jul 20 10:50 > ata-Maxtor_6Y080L0_Y2CG9M5E -> ../../hde > lrwxrwxrwx 1 root root 9 Jul 20 10:50 > ata-Maxtor_6Y080L0_Y3J1HW3E -> ../../hdg ARGH! Thanks Etaoin, I forgot about the by-id mappings. Meino, take a look at the by-id rules in 60-persistent-storage.rules. It looks like you can use the ENV{ID_SERIAL} to match SATA drives by serial. > The strange thing is that udev obviously knows the serial number of each > drive (udevinfo -q all -n /dev/sda *DOES* show the device's serial > number), but it seems that no file under /sys contains this information It uses the /lib/udev/scsi_id program to read the information directly from the drive. /lib/udev/scsi_id -g -s /block/sda -d /dev/sda -Richard -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 17:28 ` Richard Fish @ 2006-08-04 18:30 ` Meino Christian Cramer 2006-08-04 20:59 ` Richard Fish 0 siblings, 1 reply; 10+ messages in thread From: Meino Christian Cramer @ 2006-08-04 18:30 UTC (permalink / raw To: gentoo-user From: "Richard Fish" <bigfish@asmallpond.org> Subject: Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Date: Fri, 4 Aug 2006 10:28:38 -0700 > On 8/4/06, Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote: > > [Fri Aug 04 11:38:50 root@bach ~]# ls -l /dev/disk/by-id/ > > [cut] > > lrwxrwxrwx 1 root root 9 Jul 20 10:50 > > ata-Maxtor_6Y080L0_Y2CG9M5E -> ../../hde > > lrwxrwxrwx 1 root root 9 Jul 20 10:50 > > ata-Maxtor_6Y080L0_Y3J1HW3E -> ../../hdg > > ARGH! Thanks Etaoin, I forgot about the by-id mappings. > > Meino, take a look at the by-id rules in 60-persistent-storage.rules. > It looks like you can use the ENV{ID_SERIAL} to match SATA drives by > serial. > > > The strange thing is that udev obviously knows the serial number of each > > drive (udevinfo -q all -n /dev/sda *DOES* show the device's serial > > number), but it seems that no file under /sys contains this information > > It uses the /lib/udev/scsi_id program to read the information directly > from the drive. > > /lib/udev/scsi_id -g -s /block/sda -d /dev/sda > > -Richard > -- > gentoo-user@gentoo.org mailing list > Hi Richard, sorry, may be this is again a very nooby question, but... Where is that file ("60-persistent-storage.rules") ? "locate" doesn't locate that file on my system... Beside that: Great hack! Sounds like a real solution! Thanks a lot! Keep booting ! mcc -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 18:30 ` Meino Christian Cramer @ 2006-08-04 20:59 ` Richard Fish 2006-08-05 2:41 ` Meino Christian Cramer 2006-08-05 2:44 ` Meino Christian Cramer 0 siblings, 2 replies; 10+ messages in thread From: Richard Fish @ 2006-08-04 20:59 UTC (permalink / raw To: gentoo-user On 8/4/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > Where is that file ("60-persistent-storage.rules") ? > "locate" doesn't locate that file on my system... carcharias linux # equery belongs /etc/udev/rules.d/60-persistent-storage.rules [ Searching for file(s) /etc/udev/rules.d/60-persistent-storage.rules in *... ] sys-fs/udev-096-r1 (/etc/udev/rules.d/60-persistent-storage.rules) HTH, -Richard -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 20:59 ` Richard Fish @ 2006-08-05 2:41 ` Meino Christian Cramer 2006-08-05 2:44 ` Meino Christian Cramer 1 sibling, 0 replies; 10+ messages in thread From: Meino Christian Cramer @ 2006-08-05 2:41 UTC (permalink / raw To: gentoo-user, bigfish From: "Richard Fish" <bigfish@asmallpond.org> Subject: Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Date: Fri, 4 Aug 2006 13:59:11 -0700 > On 8/4/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > > Where is that file ("60-persistent-storage.rules") ? > > "locate" doesn't locate that file on my system... > > carcharias linux # equery belongs /etc/udev/rules.d/60-persistent-storage.rules > [ Searching for file(s) /etc/udev/rules.d/60-persistent-storage.rules in *... ] > sys-fs/udev-096-r1 (/etc/udev/rules.d/60-persistent-storage.rules) > > HTH, > -Richard > -- > gentoo-user@gentoo.org mailing list > solfire:/etc/udev>sudo equery belongs /etc/udev/rules.d/60-persistent-storage.rules [ Searching for file(s) /etc/udev/rules.d/60-persistent-storage.rules in *... ] solfire:/etc/udev> (not found)...is my installation damaged ??? Keep booting! mcc -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? 2006-08-04 20:59 ` Richard Fish 2006-08-05 2:41 ` Meino Christian Cramer @ 2006-08-05 2:44 ` Meino Christian Cramer 1 sibling, 0 replies; 10+ messages in thread From: Meino Christian Cramer @ 2006-08-05 2:44 UTC (permalink / raw To: gentoo-user, bigfish From: "Richard Fish" <bigfish@asmallpond.org> Subject: Re: [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Date: Fri, 4 Aug 2006 13:59:11 -0700 > On 8/4/06, Meino Christian Cramer <Meino.Cramer@gmx.de> wrote: > > Where is that file ("60-persistent-storage.rules") ? > > "locate" doesn't locate that file on my system... > > carcharias linux # equery belongs /etc/udev/rules.d/60-persistent-storage.rules > [ Searching for file(s) /etc/udev/rules.d/60-persistent-storage.rules in *... ] > sys-fs/udev-096-r1 (/etc/udev/rules.d/60-persistent-storage.rules) > > HTH, > -Richard > -- > gentoo-user@gentoo.org mailing list > ok....I found the file in /usr/porstgae/dostfiles/udev-087.tar.bz2 Keep booting the right drive! mcc -- gentoo-user@gentoo.org mailing list ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-08-05 2:50 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-08-04 4:14 [gentoo-user] udev.rules: Two "removeable" SATA-hds...how to map to /dev ??? Meino Christian Cramer 2006-08-04 9:19 ` Richard Fish 2006-08-04 9:39 ` Meino Christian Cramer 2006-08-04 17:43 ` Richard Fish 2006-08-04 10:10 ` Etaoin Shrdlu 2006-08-04 17:28 ` Richard Fish 2006-08-04 18:30 ` Meino Christian Cramer 2006-08-04 20:59 ` Richard Fish 2006-08-05 2:41 ` Meino Christian Cramer 2006-08-05 2:44 ` Meino Christian Cramer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox