пятница, 20 ноября 2015 г.

Как определить FC ID(WWN) диска(LUN) на Linux сервере

Бывает трудно найти к какому SAN относится диск и как он подключен, если к серверу подключено более двух  SAN одного типа. Получаем FC адрес на HBA.

# systool -c fc_host -v
Class = "fc_host"

Class Device = "host1"
Class Device path = "/sys/class/fc_host/host1"
fabric_name         = "0x1000000533a43ae2"
issue_lip           = <store method only>
node_name           = "0x5001438016793705"
port_id             = "0x800100"
port_name           = "0x5001438016793704"
port_state          = "Online"
port_type           = "NPort (fabric via point-to-point)"
speed               = "8 Gbit"
supported_classes   = "Class 3"
supported_speeds    = "1 Gbit, 2 Gbit, 4 Gbit, 8 Gbit"
symbolic_name       = "QMH2562 FW:v5.06.03 DVR:v8.03.07.15.05.09-k"
system_hostname     = ""
tgtid_bind_type     = "wwpn (World Wide Port Name)"
uevent              = <store method only>

Device = "host1"
Device path = "/sys/devices/pci0000:00/0000:00:07.0/0000:06:00.0/host1"
edc                 = <store method only>
fw_dump             =
nvram               = "ISP "
optrom_ctl          = <store method only>
optrom              =
reset               = <store method only>
uevent              = <store method only>
vpd                 = "-8"


Class Device = "host2"
Class Device path = "/sys/class/fc_host/host2"

... ... ...


Определяем FC и WWN.

# systool -c fc_transport -v

Class = "fc_transport"

Class Device = "0:0"
Class Device path = "/sys/class/fc_transport/target1:0:0"
node_name           = "0x500000e0d4465600"
port_id             = "0x431900"
port_name           = "0x500000e0d4465680"
uevent              = <store method only>

Device = "target1:0:0"
Device path = "/sys/devices/pci0000:00/0000:00:07.0/0000:06:00.0/host1/rport-1:0-0/target1:0:0"
uevent              = <store method only>


Class Device = "0:0"
Class Device path = "/sys/class/fc_transport/target2:0:0"
node_name           = "0x500000e0d4465600"
port_id             = "0x441900"
port_name           = "0x500000e0d4465681"
uevent              = <store method only>

Device = "target2:0:0"
Device path = "/sys/devices/pci0000:00/0000:00:07.0/0000:06:00.1/host2/rport-2:0-0/target2:0:0"
uevent              = <store method only>


Class Device = "0:10"
Class Device path = "/sys/class/fc_transport/target1:0:10"
node_name           = "0x500110a0005ad776"
port_id             = "0x433400"
port_name           = "0x500110a0005ad777"
uevent              = <store method only>

Device = "target1:0:10"
Device path = "/sys/devices/pci0000:00/0000:00:07.0/0000:06:00.0/host1/rport-1:0-10/target1:0:10"
uevent              = <store method only>


Class Device = "0:10"
Class Device path = "/sys/class/fc_transport/target2:0:10"
node_name           = "0x500110a0005ad86f"
port_id             = "0x3e4200"
port_name           = "0x500110a0005ad870"
uevent              = <store method only>

Device = "target2:0:10"
Device path = "/sys/devices/pci0000:00/0000:00:07.0/0000:06:00.1/host2/rport-2:0-10/target2:0:10"
uevent              = <store method only>

... ... ....


WWN(port_name) и WWNN(node_name) получены. Определяем соответствие между SCSI HBTL адресами и дисками. В RHEL/CentOS/Fedora нужен пакет sg3_utils.

# sg_map -x
Device /dev/nst18 is busy
/dev/sg0  1 0 0 0  0  /dev/sda
/dev/sg1  1 0 0 1  0  /dev/sdb
/dev/sg2  1 0 0 2  0  /dev/sdc
/dev/sg3  1 0 0 3  0  /dev/sdd
/dev/sg4  1 0 1 0  0  /dev/sde
/dev/sg5  1 0 1 1  0  /dev/sdf
/dev/sg6  1 0 1 2  0  /dev/sdg
/dev/sg7  1 0 1 3  0  /dev/sdh
/dev/sg8  1 0 2 0  8
/dev/sg9  1 0 3 0  1  /dev/nst0
/dev/sg10  1 0 4 0  1  /dev/nst1
/dev/sg11  1 0 5 0  1  /dev/nst2
/dev/sg12  1 0 6 0  1  /dev/nst3
/dev/sg13  1 0 7 0  1  /dev/nst4
/dev/sg14  1 0 8 0  1  /dev/nst5
/dev/sg15  1 0 9 0  1  /dev/nst6
/dev/sg16  1 0 10 0  1  /dev/nst7
/dev/sg17  1 0 11 0  1  /dev/nst8
/dev/sg18  1 0 12 0  1  /dev/nst9
/dev/sg19  1 0 13 0  1  /dev/nst10
/dev/sg20  1 0 14 0  1  /dev/nst11
/dev/sg21  2 0 0 0  0  /dev/sdi
/dev/sg22  2 0 0 1  0  /dev/sdj
/dev/sg23  2 0 0 2  0  /dev/sdk
/dev/sg24  2 0 0 3  0  /dev/sdl
/dev/sg25  2 0 1 0  0  /dev/sdm
/dev/sg26  2 0 1 1  0  /dev/sdn
/dev/sg27  2 0 1 2  0  /dev/sdo

... ... ...