[root@discus1 ˜]# cat /etc/udev/rules.d/55-openiscsi.rules KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n" [root@discus1 ˜]# [root@discus1 ˜]# cd /etc/udev/scripts [root@discus1 scripts]# ls -l iscsidev.sh -rwxr-xr-x 1 root root 334 9月 30 17:50 iscsidev.sh [root@discus1 scripts]# cat iscsidev.sh #!/bin/sh
# FILE: /etc/udev/scripts/iscsidev.sh
BUS=${1} HOST=${BUS%%:*}
[ -e /sys/class/iscsi_host ] || exit 1
file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
target_name=$(cat ${file})
# This is not an open-scsi drive if [ -z "${target_name}" ]; then exit 1 fi
echo "${target_name##*.}" [root@discus1 scripts]# [root@discus1 scripts]# chmod 755 iscsidev.sh [root@discus1 scripts]# cd [root@discus1 ˜]# service iscsi stop Logging out of session [sid: 1, target: iqn.2006-01.com.openfiler:tsn.asm1, portal: 192.168.2.5,3260] Logging out of session [sid: 2, target: iqn.2006-01.com.openfiler:tsn.asm2, portal: 192.168.2.5,3260] Logging out of session [sid: 3, target: iqn.2006-01.com.openfiler:tsn.asm3, portal: 192.168.2.5,3260] Logging out of session [sid: 4, target: iqn.2006-01.com.openfiler:tsn.asm4, portal: 192.168.2.5,3260] Logging out of session [sid: 5, target: iqn.2006-01.com.openfiler:tsn.crs, portal: 192.168.2.5,3260] Logout of [sid: 1, target: iqn.2006-01.com.openfiler:tsn.asm1, portal: 192.168.2.5,3260]: successful Logout of [sid: 2, target: iqn.2006-01.com.openfiler:tsn.asm2, portal: 192.168.2.5,3260]: successful Logout of [sid: 3, target: iqn.2006-01.com.openfiler:tsn.asm3, portal: 192.168.2.5,3260]: successful Logout of [sid: 4, target: iqn.2006-01.com.openfiler:tsn.asm4, portal: 192.168.2.5,3260]: successful Logout of [sid: 5, target: iqn.2006-01.com.openfiler:tsn.crs, portal: 192.168.2.5,3260]: successful Stopping iSCSI daemon: /etc/init.d/iscsi: line 33: 8989 強制終了 /etc/init.d/iscsid stop [root@discus1 ˜]# [ OK ] [root@discus1 ˜]# [root@discus1 ˜]# service iscsi start iscsid が停止していますが PID ファイルが残っています Turning off network shutdown. Starting iSCSI daemon: [ OK ] [ OK ] iSCSI ターゲットを設定中: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm4, portal: 192.168.2.5,3260] Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm1, portal: 192.168.2.5,3260] Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm3, portal: 192.168.2.5,3260] Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm2, portal: 192.168.2.5,3260] Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.crs, portal: 192.168.2.5,3260] Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm4, portal: 192.168.2.5,3260]: successful Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm1, portal: 192.168.2.5,3260]: successful Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm3, portal: 192.168.2.5,3260]: successful Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.asm2, portal: 192.168.2.5,3260]: successful Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.crs, portal: 192.168.2.5,3260]: successful [ OK ] [root@discus1 ˜]# [root@discus1 ˜]# (cd /dev/disk/by-path; ls -l *openfiler* | awk '{FS=" "; print $9 " " $10 " " $11}') ip-192.168.2.5:3260-iscsi-iqn.2006-01.com.openfiler:tsn.asm1 -> ../../sda ip-192.168.2.5:3260-iscsi-iqn.2006-01.com.openfiler:tsn.asm2 -> ../../sdb ip-192.168.2.5:3260-iscsi-iqn.2006-01.com.openfiler:tsn.asm3 -> ../../sdc ip-192.168.2.5:3260-iscsi-iqn.2006-01.com.openfiler:tsn.asm4 -> ../../sdd ip-192.168.2.5:3260-iscsi-iqn.2006-01.com.openfiler:tsn.crs -> ../../sde [root@discus1 ˜]# [root@discus1 ˜]# ls -l /dev/iscsi/*/* lrwxrwxrwx 1 root root 9 9月 30 17:52 /dev/iscsi/asm1/part -> ../../sda lrwxrwxrwx 1 root root 9 9月 30 17:52 /dev/iscsi/asm2/part -> ../../sdb lrwxrwxrwx 1 root root 9 9月 30 17:52 /dev/iscsi/asm3/part -> ../../sdc lrwxrwxrwx 1 root root 9 9月 30 17:52 /dev/iscsi/asm4/part -> ../../sdd lrwxrwxrwx 1 root root 9 9月 30 17:52 /dev/iscsi/crs/part -> ../../sde [root@discus1 ˜]#
|
最近のコメント