Skip to contentSkip to conversation

udev naming for scsi disk partitions

DISCUSSION Surekha.PC 2 participants 9 messages Nov 4, 2003 – Nov 10, 2003

lore
Share & tools
lore

Surekha.PC

author
#0 lore raw

Hi all,

My system is connected to iSCSI disks. With udev-005 pkg I am able to
see the device entries created in "/udev/sdc". I want to give a unique and persistent naming scheme for iSCSI device.

I have specified the following entry in "/etc/udev/udev.config" for naming the iSCSI device.

E.g:-
NUMBER, BUS="scsi" ID="6:0:69:0" NAME="c6b0t69l0"

The iSCSI disk "sdc" has 2 partitions "sdc1" and "sdc2".

I am able to generate the name for "sdc" whereas "sdc1" and "sdc2" entries remain as is.

My partitions should have the name like "c6b0t69l0s1" and "c6b0t69l0s2".

How do I achieve this with udev?

TIA,
regds
surekha

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#1 lore raw

Hi,

Added to this I have another query.

I tried to connect a tape device as an iSCSI target. Sysfs does not show up the tape device name and details, udev also does not have any device nodes created for tape.

Is this a bug in sysfs/udev?

Thanks,
surekha

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Surekha.PC
Sent: Tuesday, November 04, 2003 10:46 AM
To: [email protected]
Subject: udev naming for scsi disk partitions

Hi all,

My system is connected to iSCSI disks. With udev-005 pkg I am able to
see the device entries created in "/udev/sdc". I want to give a unique and persistent naming scheme for iSCSI device.

I have specified the following entry in "/etc/udev/udev.config" for naming the iSCSI device.

E.g:-
NUMBER, BUS="scsi" ID="6:0:69:0" NAME="c6b0t69l0"

The iSCSI disk "sdc" has 2 partitions "sdc1" and "sdc2".

I am able to generate the name for "sdc" whereas "sdc1" and "sdc2" entries remain as is.

My partitions should have the name like "c6b0t69l0s1" and "c6b0t69l0s2".

How do I achieve this with udev?

TIA,
regds
surekha

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Surekha.PC
Quoted 7 lines · Surekha.PC

Hi all,

My system is connected to iSCSI disks. With udev-005 pkg I am able to
see the device entries created in "/udev/sdc". I want to give a unique and persistent naming scheme for iSCSI device.

Quoted 5 lines

I have specified the following entry in "/etc/udev/udev.config" for naming the iSCSI device.

E.g:-
NUMBER, BUS="scsi" ID="6:0:69:0" NAME="c6b0t69l0"

What does the whole path for the scsi device look like in sysfs? I think there's probably a bug in the NUMBER matchup that gets this wrong right now (I only tested it with PCI devices, and need to get the automated test framework up and running soon...)

Quoted 8 lines

The iSCSI disk "sdc" has 2 partitions "sdc1" and "sdc2".

I am able to generate the name for "sdc" whereas "sdc1" and "sdc2" entries remain as is.

My partitions should have the name like "c6b0t69l0s1" and "c6b0t69l0s2".

How do I achieve this with udev?

This should work, but is there a better way to uniquely identify this device in sysfs? Any specific sysfs file for this device that would make a LABEL rule an easier thing to do?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#3 lore raw
In reply to Surekha.PC

Hi Greg,

In sysfs the scsi device path looks as shown below.

The sysfs's "block" device path lists the block devices detected on the system.
Here "sdc" is the iSCSI device and "sdc1" and "sdc2" are listed as 2 partitions on the iSCSI disk.

The device field below is pointing to the iSCSI host/bus/tgt/lun path.

#ls -l /sys/block/sdc
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
lrwxrwxrwx    1 root     root           35 Nov  7 08:25 device ->
../../devices/legacy/host6/6:0:69:0
drwxr-xr-x    3 root     root            0 Nov  7 08:25 queue
-r--r--r--    1 root     root         4096 Nov  7 08:25 range
drwxr-xr-x    2 root     root            0 Nov  7 08:25 sdc1
drwxr-xr-x    2 root     root            0 Nov  7 08:25 sdc2
-r--r--r--    1 root     root         4096 Nov  7 08:25 size
-r--r--r--    1 root     root         4096 Nov  7 08:25 stat

#ls -l /sys/block/sdc/sdc1:
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
-r--r--r--    1 root     root         4096 Nov  7 08:25 size
-r--r--r--    1 root     root         4096 Nov  7 08:25 start
-r--r--r--    1 root     root         4096 Nov  7 08:25 stat

#ls -l /sys/block/sdc/sdc2:
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
-r--r--r--    1 root     root         4096 Nov  7 08:25 size
-r--r--r--    1 root     root         4096 Nov  7 08:25 start
-r--r--r--    1 root     root         4096 Nov  7 08:25 stat
# ls -l /sys/devices/legacy/host6/6\:0\:69\:0/
total 0
-r--r--r--    1 root     root         4096 Nov  7 08:25 access_count
lrwxrwxrwx    1 root     root           21 Nov  7 08:25 block ->
../../../../block/sdc
--w-------    1 root     root         4096 Nov  7 08:25 delete
-rw-r--r--    1 root     root         4096 Nov  7 08:25 detach_state
-r--r--r--    1 root     root         4096 Nov  6 15:27 device_blocked
-r--r--r--    1 root     root         4096 Nov  6 15:27 model
-rw-r--r--    1 root     root         4096 Nov  6 15:27 online
drwxr-xr-x    2 root     root            0 Nov  6 15:27 power
-r--r--r--    1 root     root         4096 Nov  6 15:27 queue_depth
--w-------    1 root     root         4096 Nov  6 15:27 rescan
-r--r--r--    1 root     root         4096 Nov  6 15:27 rev
-r--r--r--    1 root     root         4096 Nov  6 15:27 scsi_level
-r--r--r--    1 root     root         4096 Nov  6 15:27 type
-r--r--r--    1 root     root         4096 Nov  6 15:27 vendor

Since sysfs is able to recognise the number of partitions on the iSCSI device, and creates unique device name as "sdc1" and "sdc2" along with its attributes, udev should be able to apply the persistent naming convention on the partitions also.

I think the sysfs file "/sys/block/sdc/sdc1" should be ideal to use for setting the LABEL rule as you have mentioned.

Thanks,
surekha

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, November 07, 2003 5:23 AM
To: Surekha.PC
Cc: [email protected]
Subject: Re: udev naming for scsi disk partitions

Quoted 7 lines · Surekha.PC

Hi all,

My system is connected to iSCSI disks. With udev-005 pkg I am able
to see the device entries created in "/udev/sdc". I want to give a unique and persistent naming scheme for iSCSI device.

Quoted 5 lines

I have specified the following entry in "/etc/udev/udev.config" for naming the iSCSI device.

E.g:-
NUMBER, BUS="scsi" ID="6:0:69:0" NAME="c6b0t69l0"

What does the whole path for the scsi device look like in sysfs? I think there's probably a bug in the NUMBER matchup that gets this wrong right now (I only tested it with PCI devices, and need to get the automated test framework up and running soon...)

Quoted 9 lines

The iSCSI disk "sdc" has 2 partitions "sdc1" and "sdc2".

I am able to generate the name for "sdc" whereas "sdc1" and "sdc2" entries remain as is.

My partitions should have the name like "c6b0t69l0s1" and "c6b0t69l0s2".

How do I achieve this with udev?

This should work, but is there a better way to uniquely identify this device in sysfs? Any specific sysfs file for this device that would make a LABEL rule an easier thing to do?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Surekha.PC
Quoted 10 lines · Surekha.PC

Hi Greg,

In sysfs the scsi device path looks as shown below.

The sysfs's "block" device path lists the block devices detected on the system.
Here "sdc" is the iSCSI device and "sdc1" and "sdc2" are listed as 2 partitions on the iSCSI disk.

Quoted 7 lines

The device field below is pointing to the iSCSI host/bus/tgt/lun path.

#ls -l /sys/block/sdc
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
lrwxrwxrwx    1 root     root           35 Nov  7 08:25 device ->

../../devices/legacy/host6/6:0:69:0

Hm, yeah that rule should have worked. Mind enabling debugging in namedev.c by uncommenting the line:
//#define DEBUG_PARSER

at the top of the file? If you rebuild udev, and then send me the syslog debug messages when you plug the device in, I'd really apreciate it.

Quoted 2 lines

I think the sysfs file "/sys/block/sdc/sdc1" should be ideal to use for setting the LABEL rule as you have mentioned.

Hm, if it's always sdc1, why not just use a simple REPLACE rule? Something like the following rules should work for you:

REPLACE, KERNEL="sdc1", NAME="c6b0t69l01"
REPLACE, KERNEL="sdc2", NAME="c6b0t69l02"

Will that work?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#5 lore raw
In reply to Surekha.PC

Please find my comments interspersed below with "=>" mark.

Quoted 6 lines

In sysfs the scsi device path looks as shown below.

The sysfs's "block" device path lists the block devices detected on the system. Here "sdc" is the iSCSI device and "sdc1" and "sdc2" are listed as 2 partitions on the iSCSI disk.

Quoted 7 lines

The device field below is pointing to the iSCSI host/bus/tgt/lun path.

#ls -l /sys/block/sdc
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
lrwxrwxrwx    1 root     root           35 Nov  7 08:25 device ->

../../devices/legacy/host6/6:0:69:0

Hm, yeah that rule should have worked. Mind enabling debugging in namedev.c by uncommenting the line: //#define DEBUG_PARSER at the top of the file? If you rebuild udev, and then send me the syslog debug messages when you plug the device in, I'd really apreciate it.

=> I have enabled the debug as mentioned above. Could you pls tell me where the messages are logged, "/var/log/messages" file doesn't have any ?

Quoted 2 lines

I think the sysfs file "/sys/block/sdc/sdc1" should be ideal to use for setting the LABEL rule as you have mentioned.

Hm, if it's always sdc1, why not just use a simple REPLACE rule? Something like the following rules should work for you:

REPLACE, KERNEL="sdc1", NAME="c6b0t69l01"
REPLACE, KERNEL="sdc2", NAME="c6b0t69l02"

Will that work?

=> But it need not be sdc1 always, a disk can have any number of partitions, then the config file will need to be changed always :(

Thanks,
surekha

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#6 lore raw
In reply to Surekha.PC
Quoted 24 lines · Surekha.PC

Please find my comments interspersed below with "=>" mark.

Quoted 6 lines

In sysfs the scsi device path looks as shown below.

The sysfs's "block" device path lists the block devices detected on the system. Here "sdc" is the iSCSI device and "sdc1" and "sdc2" are listed as 2 partitions on the iSCSI disk.

Quoted 7 lines

The device field below is pointing to the iSCSI host/bus/tgt/lun path.

#ls -l /sys/block/sdc
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
lrwxrwxrwx    1 root     root           35 Nov  7 08:25 device ->

../../devices/legacy/host6/6:0:69:0

Hm, yeah that rule should have worked. Mind enabling debugging in namedev.c by uncommenting the line: //#define DEBUG_PARSER at the top of the file? If you rebuild udev, and then send me the syslog debug messages when you plug the device in, I'd really apreciate it.

Quoted 3 lines

=> I have enabled the debug as mentioned above. Could you pls tell me where the messages are logged, "/var/log/messages" file doesn't have any ?

You need to tell syslogd to write the system wide debug messages somewhere. I have the following line in my /etc/syslog.conf:

*.debug /var/log/debug

Restart syslogd and look in that file.

Quoted 6 lines
Quoted 2 lines

I think the sysfs file "/sys/block/sdc/sdc1" should be ideal to use for setting the LABEL rule as you have mentioned.

Hm, if it's always sdc1, why not just use a simple REPLACE rule? Something like the following rules should work for you:

Quoted 7 lines

REPLACE, KERNEL="sdc1", NAME="c6b0t69l01"
REPLACE, KERNEL="sdc2", NAME="c6b0t69l02"

Will that work?

=> But it need not be sdc1 always, a disk can have any number of partitions, then the config file will need to be changed always :(

Yes, you are correct, I just thought you said it would always be those kernel names :)

How about any of the sysfs files? Are they going to hold unique values? The vendor file? model file?

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#7 lore raw
In reply to Surekha.PC

Hi Greg,

Thanks for the info, I was able to enable the debug, I have captured the log with the iSCSI disk plugged in. I have enclosed the logfile FYI.

The iSCSI disk has been allocated the device name "sdc".

# ls -l /sys/block/sdc/
total 0
-r--r--r--    1 root     root         4096 Nov 10 13:24 dev
lrwxrwxrwx    1 root     root           35 Nov 10 13:24 device ->
../../devices/legacy/host2/2:0:69:0
drwxr-xr-x    3 root     root            0 Nov 10 13:24 queue
-r--r--r--    1 root     root         4096 Nov 10 13:24 range
drwxr-xr-x    2 root     root            0 Nov 10 13:24 sdc1
drwxr-xr-x    2 root     root            0 Nov 10 13:24 sdc2
-r--r--r--    1 root     root         4096 Nov 10 13:24 size
-r--r--r--    1 root     root         4096 Nov 10 13:24 stat

The sysfs file "dev" under the follg path hold unique major and minor numbers for the device.

#more /sys/block/sdc/dev
8:32
#more /sys/block/sda/sdc1/dev
8:33
#more /sys/block/sda/sdc2/dev
8:34

Quoted 1 line

How about any of the sysfs files? Are they going to hold unique

values? The vendor file? >model file?

Do you mean unique values w.r.t partition or disk ?

Vendor/model info need not be unique across disks. Also this information is specific to a disk and not its partitions, so I feel it would not useful for naming the partitons.

Pls let me know your comments.

Thanks,
surekha

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Greg KH
Sent: Saturday, November 08, 2003 1:02 AM
To: Surekha.PC
Cc: [email protected]
Subject: Re: udev naming for scsi disk partitions

Quoted 20 lines · Surekha.PC

Please find my comments interspersed below with "=>" mark.

Quoted 7 lines

In sysfs the scsi device path looks as shown below.

The sysfs's "block" device path lists the block devices detected on the system. Here "sdc" is the iSCSI device and "sdc1" and "sdc2" are

listed as 2 partitions on the iSCSI disk.

Quoted 8 lines

The device field below is pointing to the iSCSI host/bus/tgt/lun path.

#ls -l /sys/block/sdc
total 0

-r--r--r--    1 root     root         4096 Nov  7 08:25 dev
lrwxrwxrwx    1 root     root           35 Nov  7 08:25 device ->

../../devices/legacy/host6/6:0:69:0

Quoted 8 lines

Hm, yeah that rule should have worked. Mind enabling debugging in namedev.c by uncommenting the line: //#define DEBUG_PARSER at the top of the file? If you rebuild udev, and then send me the syslog debug messages when you plug the device in, I'd really apreciate it.

=> I have enabled the debug as mentioned above. Could you pls tell me where the messages are logged, "/var/log/messages" file doesn't have any ?

You need to tell syslogd to write the system wide debug messages somewhere. I have the following line in my /etc/syslog.conf:

*.debug /var/log/debug

Restart syslogd and look in that file.

Quoted 6 lines
Quoted 2 lines

I think the sysfs file "/sys/block/sdc/sdc1" should be ideal to use for setting the LABEL rule as you have mentioned.

Hm, if it's always sdc1, why not just use a simple REPLACE rule? Something like the following rules should work for you:

Quoted 7 lines

REPLACE, KERNEL="sdc1", NAME="c6b0t69l01"
REPLACE, KERNEL="sdc2", NAME="c6b0t69l02"

Will that work?

=> But it need not be sdc1 always, a disk can have any number of partitions, then the config file will need to be changed always :(

Yes, you are correct, I just thought you said it would always be those kernel names :)

How about any of the sysfs files? Are they going to hold unique values? The vendor file? model file?

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more!
http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#8 lore raw
In reply to Surekha.PC
Quoted 7 lines · Surekha.PC

Hi Greg,

Thanks for the info, I was able to enable the debug, I have captured the log with the iSCSI disk plugged in. I have enclosed the logfile FYI.

The iSCSI disk has been allocated the device name "sdc".

Ah, thanks. Hm, it looks like the main sdc block device is being created with the name you want, right, but not the partitions?

Yeah, I see the bug now, the partition logic is only currently in the LABEL logic, I'll fix it up let partitions work for all types of rules, very sorry about this. Thanks for helping me track this down.

I should have this fixed in the next release, which is being delayed a bit by me being on paternity leave for all of November due to the birth of my son...

thanks,

greg k-h

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel