SUSE Support

Here When You Need Us

Customizing persistent device names for an iSCSI disk

This document (3684654) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10
SUSE Linux Enterprise Desktop 10

 

Situation

The iSCSI disk is already set up and is accessible under a /dev/sd* name, e.g /dev/sdb. [1]

Goal: to customize a persistent device name for an iSCSI disk, e.g. with customer device file ownership or permissions.

Resolution

With SLE10 a persistent device name should be available automatically. Please refer to the chapterDynamic Kernel Device Management with udevin the Installation and Administration Guide for background.

With the default udev rules in place, an entry in /dev/disk/by-path/ and
/dev/disk/by-id/ will have been created already. This entry can be found, either by searching that directory, or by running udevtest on the sysfs entry for the non-persistent device name, so if the disk is currently accessible as /dev/sdb, run
udevtest /block/sdb
The output should be similar to the following:
 
main: looking at device'/block/sdb' from subsystem 'block'
run_program: '/sbin/usb_id -x'
run_program: '/sbin/usb_id' returned with status 1
run_program: '/sbin/scsi_id -g -x -s /block/sdb -d /dev/.tmp-8-16'
run_program: '/sbin/scsi_id' (stdout) 'ID_VENDOR=IET'
run_program: '/sbin/scsi_id' (stdout) 'ID_MODEL=VIRTUAL-DISK'
run_program: '/sbin/scsi_id' (stdout) 'ID_REVISION=0'
run_program: '/sbin/scsi_id' (stdout)'ID_SERIAL=149455400000000000000000003000000410000000100d00f'
run_program: '/sbin/scsi_id' (stdout) 'ID_TYPE=disk'
run_program: '/sbin/scsi_id' (stdout) 'ID_BUS=scsi'
run_program: '/sbin/scsi_id' returned with status 0
udev_rules_get_name: add symlink'disk/by-id/scsi-149455400000000000000000003000000410000000100d00f'
run_program: '/sbin/path_id /block/sdb'
run_program: '/sbin/path_id' (stdout)'ID_PATH=ip-10.0.23.10:3260-iscsi-iqn.2007-05.com.suse:storage.disk2.sys1.test1'
run_program: '/sbin/path_id' returned with status 0
udev_rules_get_name: add symlink'disk/by-path/ip-10.0.23.10:3260-iscsi-iqn.2007-05.com.suse:storage.disk2.sys1.test1'
run_program: '/sbin/path_id /block/sdb'
run_program: '/sbin/path_id' (stdout)'ID_PATH=ip-10.0.23.10:3260-iscsi-iqn.2007-05.com.suse:storage.disk2.sys1.test1'
run_program: '/sbin/path_id' returned with status 0
udev_rules_get_name: add symlink'disk/by-path/ip-10.0.23.10:3260-iscsi-iqn.2007-05.com.suse:storage.disk2.sys1.test1'
run_program: '/sbin/vol_id --export /dev/.tmp-8-16'
run_program: '/sbin/vol_id' returned with status 4
run_program: '/sbin/edd_id --export /dev/.tmp-8-16'
run_program: '/sbin/edd_id' (stderr) 'no EDD signature '/dev/.tmp-8-16''
run_program: '/sbin/edd_id' returned with status 9
udev_rules_get_name: no node name set, will use kernel name 'sdb'
create_node: creating device node'/dev/sdb', major = '8', minor = '16', mode = '0660', uid = '0', gid = '100'
create_node: creating symlink'/dev/disk/by-id/scsi-149455400000000000000000003000000410000000100d00f' to '../../sdb'
create_node: creating symlink'/dev/disk/by-path/ip-10.0.23.10:3260-iscsi-iqn.2007-05.com.suse:storage.disk2.sys1.test1' to '../../sdb'
main: run:'socket:/org/freedesktop/hal/udev_event'
main: run:'socket:/org/kernel/udev/monitor'

Note how the udevtest output for a disk includes a number of characteristics through which the disk can be identified, for example a vendor name (ID_VENDOR) and a serial number (ID_SERIAL). These variables can be used to write a custom udev rule when the default link name, device permission, or device ownership are not suitable for your use.

E.g., by adding the following line to /etc/udev/rules.d/60-persistent-storage.rules:
KERNEL=="sd*", ENV{ID_VENDOR}=="IET", IMPORT{program}="/sbin/path_id %p", MODE="0640", OWNER="john", GROUP="users", SYMLINK+="disk/by-path/$env{ID_PATH}"
all iSCSI disks (identified by the vendor ID IET) will be owned by user john / group users, with read and write rights for john, read rights for the group users and no rights for others.

When the udev rules are changed, you can immediately use udevtest to test them. To activate the changed settings, restart the iSCSI initiator setup by running
rcopen-iscsi restart

Please refer to the product documentation for more information about writing custom udev rules.

Additional Information

[1] To set up an iSCSI disk, refer to the product documentation (in particular, the chapterMass Storage over IP Networks—iSCSI) and other relevant documentation.



CODE9

The iSCSI and hotplug infrastructure in CODE9 products (SUSE Linux Enterprise Server 9, SUSE Linux Desktop 9, Open Enterprise Server 1 (Linux based)) was significantly different from that in CODE10.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3684654
  • Creation Date: 15-Oct-2007
  • Modified Date:05-Mar-2021
    • SUSE Linux Enterprise Desktop
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.