Fibrechannel Analyse: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
m (Text replacement - "</source" to "</syntaxhighlight")
 
(37 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Kategorie:Solaris]]
[[category:Solaris]]
[[Kategorie:Brocade]]
[[category:Brocade]]
=Fibrechannel Analyse unter Solaris=
[[category:NetApp]]
[[category:FC]]
=Fibrechannel Analyse=


=Kommandos : Solaris=
=Kommandos : Solaris=
Line 7: Line 9:
===luxadm -e port===
===luxadm -e port===
Gibt die Hardwarepfade der vorhandened Fibrechannelports und deren Status aus:
Gibt die Hardwarepfade der vorhandened Fibrechannelports und deren Status aus:
<source lang=bash>
<syntaxhighlight lang=bash>
# luxadm -e port
# luxadm -e port
/devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl        CONNECTED
/devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl        CONNECTED
Line 13: Line 15:
/devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:devctl        CONNECTED
/devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:devctl        CONNECTED
/devices/pci@79,0/pci10de,376@e/pci1077,143@0,1/fp@0,0:devctl      NOT CONNECTED
/devices/pci@79,0/pci10de,376@e/pci1077,143@0,1/fp@0,0:devctl      NOT CONNECTED
</source>
</syntaxhighlight>
  2 Dualport Karten:
  2 Dualport Karten:
  /devices/pci@79,0/pci10de,378@b/pci1077,143@0 und ...,1
  /devices/pci@79,0/pci10de,378@b/pci1077,143@0 und ...,1
  /devices/pci@79,0/pci10de,376@e/pci1077,143@0 und ...,1
  /devices/pci@79,0/pci10de,376@e/pci1077,143@0 und ...,1


<source lang=bash>
<syntaxhighlight lang=bash>
# prtdiag -v | head -1
# prtdiag -v | head -1
System Configuration: Sun Microsystems    Sun Fire X4440
System Configuration: Sun Microsystems    Sun Fire X4440
</source>
</syntaxhighlight>


Aus der Seite [https://support.oracle.com/epmos/faces/DocContentDisplay?id=1277396.1 Sun x86 Platforms: Matrix of Recognized Device Paths (Doc ID 1277396.1)] (Oracle Support Login benötigt):
Aus der Seite [https://support.oracle.com/epmos/faces/DocContentDisplay?id=1277396.1 Sun x86 Platforms: Matrix of Recognized Device Paths (Doc ID 1277396.1)] (Oracle Support Login benötigt):
Line 39: Line 41:
===luxadm -e dump_map <HW_path>===
===luxadm -e dump_map <HW_path>===
Gibt die Tabelle der bekannten Geräte an einem Port aus
Gibt die Tabelle der bekannten Geräte an einem Port aus
<source lang=bash>
<syntaxhighlight lang=bash>
# luxadm -e dump_map /devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl
# luxadm -e dump_map /devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl
Pos  Port_ID Hard_Addr Port WWN        Node WWN        Type
Pos  Port_ID Hard_Addr Port WWN        Node WWN        Type
Line 51: Line 53:
7    30500  0        203300a0b85aeb2d 200200a0b85aeb2d 0x0  (Disk device)
7    30500  0        203300a0b85aeb2d 200200a0b85aeb2d 0x0  (Disk device)
8    10800  0        2100001b32902d45 2000001b32902d45 0x1f (Unknown Type,Host Bus Adapter)
8    10800  0        2100001b32902d45 2000001b32902d45 0x1f (Unknown Type,Host Bus Adapter)
</source>
</syntaxhighlight>
Erklärung der interessanten Spalten:
Erklärung der interessanten Spalten:
* Port_ID <Switch_ID><Switchport><??>
* Port_ID <Switch_ID><Switchport><??>
Line 78: Line 80:
  Disk Device: Storage
  Disk Device: Storage
  Host Bus Adapter: FC-Karte
  Host Bus Adapter: FC-Karte
===luxadm -e rdls <HW_path> ===
<syntaxhighlight lang=bash>
# luxadm -e port 2>/dev/null | awk '{print $1;}' | xargs -n 1 luxadm -e rdls 2>/dev/null
Link Error Status information for loop:/devices/pci@0,0/pci8086,340e@7/pci111d,806e@0/pci111d,806e@2/pci1077,143@0/fp@0,0:devctl
al_pa  lnk fail    sync loss  signal loss  sequence err  invalid word  CRC
30200  2          1          0            0              0              0         
30600  2          1          0            0              0              0         
10200  1          1          0            0              0              0         
11400  2          1          0            0              0              0         
10b00  0          0          0            0              0              0         
NOTE: These LESB counts are not cleared by a reset, only power cycles.
These counts must be compared to previously read counts.
Link Error Status information for loop:/devices/pci@0,0/pci8086,340e@7/pci111d,806e@0/pci111d,806e@2/pci1077,143@0,1/fp@0,0:devctl
al_pa  lnk fail    sync loss  signal loss  sequence err  invalid word  CRC
0      0          0          0            0              0              0         
NOTE: These LESB counts are not cleared by a reset, only power cycles.
These counts must be compared to previously read counts.
</syntaxhighlight>


===luxadm probe===
===luxadm probe===
Auflistung aller erkannten Fibrechanneldevices
Auflistung aller erkannten Fibrechanneldevices
<source lang=bash>
<syntaxhighlight lang=bash>
#> luxadm probe
#> luxadm probe


Line 88: Line 111:
     Logical Path:/dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
     Logical Path:/dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
...
...
</source>
</syntaxhighlight>


===luxadm display <Diskpath|WWN>===
===luxadm display <Diskpath|WWN>===
<source lang=bash>
<syntaxhighlight lang=bash>
#>  luxadm display /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
#>  luxadm display /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
Line 128: Line 151:
     Class                      secondary
     Class                      secondary
     State                      STANDBY
     State                      STANDBY
</source>
</syntaxhighlight>
* Vendor:              SUN
* Vendor:              SUN
  Hersteller
  Hersteller
Line 152: Line 175:


Zuweisung Controller zum FC-Port über:
Zuweisung Controller zum FC-Port über:
<source lang=bash>
<syntaxhighlight lang=bash>
# ls -al /dev/cfg/c6
# ls -al /dev/cfg/c6
lrwxrwxrwx  1 root    root          60 Sep  3  2009 /dev/cfg/c6 -> ../../devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:fc
lrwxrwxrwx  1 root    root          60 Sep  3  2009 /dev/cfg/c6 -> ../../devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:fc
</source>
</syntaxhighlight>
Man sieht den Hardwarepfad von [[#luxadm -e port]]
Man sieht den Hardwarepfad von [[#luxadm -e port]]


Line 164: Line 187:
===fcinfo hba-port===
===fcinfo hba-port===
Gibt ein paar Infos über Hersteller, Modell, Firmware, Port und Node WWN, Current Speed, ... aus
Gibt ein paar Infos über Hersteller, Modell, Firmware, Port und Node WWN, Current Speed, ... aus
<source lang=bash>
<syntaxhighlight lang=bash>
#> fcinfo hba-port
#> fcinfo hba-port
HBA Port WWN: 2100001b328a417f
HBA Port WWN: 2100001b328a417f
Line 222: Line 245:
         Current Speed: not established
         Current Speed: not established
         Node WWN: 2001001b32b04445
         Node WWN: 2001001b32b04445
</source>
</syntaxhighlight>
===fcinfo remote-port --port <HBA Port WWN> --linkstat===
===fcinfo remote-port --port <HBA Port WWN> --linkstat===
<source lang=bash>
<syntaxhighlight lang=bash>
# fcinfo remote-port --port 2100001b32904445 --linkstat
# fcinfo remote-port --port 2100001b32904445 --linkstat
Remote Port WWN: 201600a0b86e103c
Remote Port WWN: 201600a0b86e103c
Line 314: Line 337:
                 Invalid Tx Word Count: 0
                 Invalid Tx Word Count: 0
                 Invalid CRC Count: 0
                 Invalid CRC Count: 0
</source>
</syntaxhighlight>
===fcinfo remote-port --port <HBA Port WWN> --scsi-target===
<syntaxhighlight lang=bash>
# fcinfo hba-port | grep HBA
HBA Port WWN: 21000024ff3cf472
HBA Port WWN: 21000024ff3cf473
HBA Port WWN: 21000024ff3cf454
HBA Port WWN: 21000024ff3cf455
 
# fcinfo remote-port --port 21000024ff3cf472 --scsi-target
Remote Port WWN: 20110002ac0059ce
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 2ff70002ac0059ce
        LUN: 0
          Vendor: 3PARdata
          Product: VV             
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000002000059CEd0s2
        LUN: 1
          Vendor: 3PARdata
          Product: VV             
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000003000059CEd0s2
        LUN: 2
          Vendor: 3PARdata
          Product: VV             
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000004000059CEd0s2
...
</syntaxhighlight>
===fcinfo lu -v <device>===
<syntaxhighlight lang=bash>
# fcinfo lu -v /dev/rdsk/c0t60030D90D9DD1A059655804D4A5EAD2Ed0s2
OS Device Name: /dev/rdsk/c0t60030D90D9DD1A059655804D4A5EAD2Ed0s2
        HBA Port WWN: 2100000e1ed89451
        Controller: /dev/cfg/c4
                Remote Port WWN: 2100f4e9d4564d21
                        LUN: 11
                        State: active/optimized
                Remote Port WWN: 2100f4e9d4564c97
                        LUN: 11
                        State: active/non-optimized
        HBA Port WWN: 2100000e1ed89450
        Controller: /dev/cfg/c3
                Remote Port WWN: 2100f4e9d4564d44
                        LUN: 11
                        State: active/optimized
                Remote Port WWN: 2100f4e9d4564c1c
                        LUN: 11
                        State: active/non-optimized
        Vendor: DataCore
        Product: Virtual Disk   
        Device Type: Disk Device
        Unformatted capacity: 204800.000 MBytes
</syntaxhighlight>


==mpathadm==
==mpathadm==
===mpathadm list lu===
===mpathadm list lu===
<source lang=bash>
<syntaxhighlight lang=bash>
</source>
</syntaxhighlight>
==cfgadm==
==cfgadm==
===cfgadm -al -o show_FCP_dev [<controller>]===
===cfgadm -al -o show_FCP_dev [<controller>]===
<source lang=bash>
<syntaxhighlight lang=bash>
# cfgadm -al -o show_FCP_dev  | grep unusable
# cfgadm -al -o show_FCP_dev  | grep unusable
c8::21000024ff2d49a2,0        disk        connected    configured  unusable
c8::21000024ff2d49a2,0        disk        connected    configured  unusable
Line 339: Line 414:
c9::203500a0b839c421,31        disk        connected    configured  unusable
c9::203500a0b839c421,31        disk        connected    configured  unusable
c9::203500a0b84913d2,31        disk        connected    configured  unusable
c9::203500a0b84913d2,31        disk        connected    configured  unusable
</source>
</syntaxhighlight>


===cfgadm -c unconfigure -o unusable_SCSI_LUN <unusable device>===
===cfgadm -c unconfigure -o unusable_SCSI_LUN <unusable device>===
<source lang=bash>
<syntaxhighlight lang=bash>
# cfgadm -c unconfigure -o unusable_SCSI_LUN c8::21000024ff2d49a2
# cfgadm -c unconfigure -o unusable_SCSI_LUN c8::21000024ff2d49a2
</source>
</syntaxhighlight>
 
Alle aufräumen:
<syntaxhighlight lang=bash>
# cfgadm -alo show_SCSI_LUN | nawk '$NF=="unusable"{gsub(/,[0-9]+$/,"",$1);print $1}' | sort -u | xargs -n 1 cfgadm -c unconfigure -o unusable_SCSI_LUN
</syntaxhighlight>


===cfgadm -o force_update -c configure <controller>===
===cfgadm -o force_update -c configure <controller>===
Rescan LUNs. Be careful! Does a forcelip!
Rescan LUNs. Be careful! Does a forcelip!
<source lang=bash>
<syntaxhighlight lang=bash>
# cfgadm -o force_update -c configure c10
# cfgadm -o force_update -c configure c10
</source>
</syntaxhighlight>
 
 
==prtconf -Da <device>==
<syntaxhighlight lang=bash>
# prtconf -Da /dev/cfg/c3
i86pc (driver name: rootnex)
    pci, instance #0 (driver name: npe)
        pci8086,3410, instance #5 (driver name: pcieb)
            pci111d,806e, instance #12 (driver name: pcieb)
                pci111d,806e, instance #13 (driver name: pcieb)
                    pci1077,170, instance #0 (driver name: qlc)  <---
                        fp, instance #0 (driver name: fp)
</syntaxhighlight>
 
 
==LUN masking (access LUNs of a storage)==
<syntaxhighlight lang=bash>
Nov  6 13:44:59 server01        Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@380/pci@1/pci@0/pci@5/SUNW,qlc@0/fp@0,0/ssd@w204300a096691217,7 (ssd7):
Nov  6 13:44:59 server01        Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@380/pci@1/pci@0/pci@5/SUNW,qlc@0/fp@0,0/ssd@w204300a096691217,7 (ssd7):
Nov  6 13:44:59 server01        Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@300/pci@1/pci@0/pci@4/SUNW,qlc@0/fp@0,0/ssd@w203300a096691217,7 (ssd2):
Nov  6 13:44:59 server01        Corrupt label; wrong magic number
...
</syntaxhighlight>
 
<syntaxhighlight lang=bash>
# cat /etc/driver/drv/fp.conf
mpxio-disable="no";
pwwn-lun-blacklist=
"203200a096691265,7",
"203300a096691265,7",
"204200a096691265,7",
"204300a096691265,7",
"203200a096691217,7",
"203300a096691217,7",
"204200a096691217,7",
"204300a096691217,7";
</syntaxhighlight>
 
<syntaxhighlight lang=bash>
# reboot -- -r
...
Boot device: /pci@300/pci@1/pci@0/pci@2/scsi@0/disk@p0  File and args: -r
SunOS Release 5.11 Version 11.3 64-bit
Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203300a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203200a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203300a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203200a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204300a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204200a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204300a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204200a096691265 is masked due to black listing.
Configuring devices.
 
</syntaxhighlight>


=Kommandos : Common Array Manager=
=Kommandos : Common Array Manager=
Line 356: Line 502:
Ist unter Solaris in /opt/SUNWsefms/bin
Ist unter Solaris in /opt/SUNWsefms/bin
===lsscs list array===
===lsscs list array===
<source lang=bash>
<syntaxhighlight lang=bash>
</source>
</syntaxhighlight>
===lsscs list array <array_name>===
===lsscs list array <array_name>===
<source lang=bash>
<syntaxhighlight lang=bash>
</source>
</syntaxhighlight>
===lsscs list -a <array_name> fcport===
===lsscs list -a <array_name> fcport===
<source lang=bash>
<syntaxhighlight lang=bash>
</source>
</syntaxhighlight>


=Kommandos : Brocade=
=Kommandos : Brocade=
Line 369: Line 515:
===switchshow===
===switchshow===


<source lang=bash>
<syntaxhighlight lang=bash>
san-sw_11:admin> switchshow
san-sw_11:admin> switchshow
switchName: san-sw_11
switchName: san-sw_11
Line 408: Line 554:
   22  22  011600  --    N8  No_Module  FC  (No POD License) Disabled
   22  22  011600  --    N8  No_Module  FC  (No POD License) Disabled
   23  23  011700  --    N8  No_Module  FC  (No POD License) Disabled
   23  23  011700  --    N8  No_Module  FC  (No POD License) Disabled
</source>
</syntaxhighlight>
What do we see?
Was sagt uns das?
# Dies ist der "Principal" (alle andere sind "Subordinate") der Fabric "Fabric1" (switchRole:, zoning:)
# Der Switch ist gezoned (zoning:)
# SwitchID ist "fffc01"
# Es ist ein 24-Port Switch
# Es gibt einen doppelten ISL (InterSwitchLink) zu einem anderen Switch E-Port (san-sw_21)
# 6 Ports sind mit SFPs bestückt, aber nicht belegt (0,4,11-15)
# 8 Ports haben keine Lizenz und auch kein SFP (No_Module)
# 9 Ports sind belegt


1. There is a dual ISL (InterSwitchLink) to another switch (san-sw_21)
===fabricshow===
2. 16 ports are
<syntaxhighlight lang=bash>
san-sw_11:root> fabricshow
Switch ID  Worldwide Name          Enet IP Addr    FC IP Addr      Name
-------------------------------------------------------------------------
  1: fffc01 10:00:00:05:33:df:43:5a 192.168.1.117 0.0.0.0          >"san-sw_11"
  2: fffc02 10:00:00:05:33:df:bd:b9 192.168.1.119 0.0.0.0          "san-sw_21"
 
The Fabric has 2 switches
</syntaxhighlight>
===islshow===
<syntaxhighlight lang=bash>
rz1_fab2_11:admin> islshow
  1:  1->  0 10:00:00:05:1e:0d:5e:96  12 bc1_sl4_fab2_12 sp:  4.000G bw:  4.000G
  2:  2->  0 10:00:00:05:1e:0d:e2:53  13 bc2_sl4_fab2_13 sp:  4.000G bw:  4.000G
  3:  3->  0 10:00:00:05:1e:b3:71:bf  14 bc3_sl4_fab2_14 sp:  4.000G bw:  4.000G
  4:  5-> 17 10:00:00:05:1e:0d:5e:96  12 bc1_sl4_fab2_12 sp:  4.000G bw:  4.000G
  5:  6-> 17 10:00:00:05:1e:0d:e2:53  13 bc2_sl4_fab2_13 sp:  4.000G bw:  4.000G
  6:  7-> 17 10:00:00:05:1e:b3:71:bf  14 bc3_sl4_fab2_14 sp:  4.000G bw:  4.000G
  7: 10->  8 10:00:50:eb:1a:45:71:96  15 rz-6510-fab2-15 sp:  4.000G bw:  4.000G
  8: 18->  0 10:00:50:eb:1a:45:71:96  15 rz-6510-fab2-15 sp:  4.000G bw:  4.000G
</syntaxhighlight>


==Port-Kommandos==
==Port-Kommandos==
===porterrshow===
===portstatsshow===
===portstatsshow===
===portstatsclear===
===portstatsclear===
===portloginshow===
Show information about NPIV-ports.
<syntaxhighlight lang=bash>
fcsw1:admin> switchshow     
...
Index Port Address Media Speed      State  Proto
==================================================
...
  34  34  0f2200  id    N16   Online      FC  F-Port  1 N Port + 1 NPIV public
...
</syntaxhighlight>
This is a NetApp 8080 with CDOT behind this port as you can see with <i>nodefind <address></i>
<syntaxhighlight lang=bash>
fcsw1:admin> nodefind 0f2200
Local:
Type Pid    COS    PortName                NodeName                SCR
N    0f2200;      3;50:0a:09:82:80:d1:21:ee;50:0a:09:80:80:d1:21:ee; 0x00000000
    PortSymb: [45] "NetApp FC Target Adapter (8324) cdot1-01:0g"
    NodeSymb: [38] "NetApp FAS8080 (cdot1-01/cdot1-02)"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: Physical Unknown(initiator/target)
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No
    Partial: No
    LSAN: No
    Aliases:
</syntaxhighlight>
Now look with <i>portloginshow <portnumber></i>:
<syntaxhighlight lang=bash>
fcsw1:admin> portloginshow 34   
Type  PID    World Wide Name        credit df_sz cos
=====================================================
  fd  0f2201 20:00:00:a0:98:5d:33:82    6  2048  8  scr=0x3
  fe  0f2200 50:0a:09:82:80:d1:21:ee    6  2048  8  scr=0x0
  ff  0f2201  20:00:00:a0:98:5d:33:82    0    0  8  d_id=FFFFFC 
  ff  0f2200  50:0a:09:82:80:d1:21:ee    0    0  8  d_id=FFFFFC 
</syntaxhighlight>
With this information you can find out more about the WWNs:
<syntaxhighlight lang=bash>
fcsw1:admin> nodefind 20:00:00:a0:98:5d:33:82
Local:
Type Pid    COS    PortName                NodeName                SCR
N    0f2201;      3;20:00:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-01_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: NPIV Target
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No
    Partial: No
    LSAN: No
    Aliases: cdot1fc_01_lif1
</syntaxhighlight>
Even the VServer (NodeSymb)!
And with the NodeName you can find all logical interfaces of this svm:
<syntaxhighlight lang=bash>
fcsw1:admin> nodefind 20:04:00:a0:98:5d:33:82
Local:
Type Pid    COS    PortName                NodeName                SCR
N    0f2201;      3;20:00:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-01_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: NPIV Target
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No
    Partial: No
    LSAN: No
    Aliases: cdot1fc_01_lif1
N    0f2301;      3;20:02:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-02_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:23:50:eb:1a:42:f8:45
    Permanent Port Name: 50:0a:09:82:80:61:21:e8
    Device type: NPIV Target
    Port Index: 35
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No
    Partial: No
    LSAN: No
    Aliases: cdot1fc_02_lif1
</syntaxhighlight>


==Zone-Kommandos==
==Zone-Kommandos==
Line 422: Line 697:
===alicreate===
===alicreate===
===alishow===
===alishow===
==Backup der Switchconfig per Script==
===Put the backup host ssh-pub-key on the switches===
<syntaxhighlight lang=bash>
fcsw1:root> cat >/root/.ssh/authorized_keys <<EOF
> ssh-dss AAAAB3NzaC1...
...
...
lF8qsgtTD8cc= root@host
> EOF
</syntaxhighlight>
===Generate ssh-key on the switches===
<syntaxhighlight lang=bash>
fcsw1:root> ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
2a:23:33:...:69:bc:25:a5:f9 root@fcsw1
The key's randomart image is:
+--[ RSA 2048]----+
|                |
| ...            |
|                |
+-----------------+
</syntaxhighlight>
===Copy the key to your backup users ~/.ssh/authorized_keys on backup host===
<syntaxhighlight lang=bash>
fcsw1:root> cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAA...
...
KHnw1T1NaQ== root@fcsw1
</syntaxhighlight>
===Now the script on the backup host===
<syntaxhighlight lang=bash>
# cat /opt/bin/backup_brocade_config
#!/bin/bash
SWITCHES="
172.30.40.50
172.30.40.51
"
LOCALUSER="backupuser"
BACKUPDIR="brocade_backup"
BACKUPHOST="172.30.40.10"
DATE="$(date '+%Y%m%d-%H%M%S')"
for switch in ${SWITCHES} ; do
  printf "Backing up ${switch} to ~${LOCALUSER}/${BACKUPDIR}/${switch}_config_${date}.txt... "
  ssh root@${switch} /fabos/link_sbin/configupload -all -p scp ${BACKUPHOST},${LOCALUSER},${BACKUPDIR}/${switch}_config_${DATE}.txt
done
</syntaxhighlight>
==Script zum parsen einer configupload-Datei==
<syntaxhighlight lang=awk>
#!/usr/bin/gawk -f
BEGIN{
  vendor["001438"]="Hewlett-Packard";
  vendor["00a098"]="NetApp";
  vendor["0024ff"]="Qlogic";
  vendor["001b32"]="Qlogic";
  vendor["0000c9"]="Emulex";
  vendor["00e002"]="CROSSROADS SYSTEMS, INC.";
 
}
/\[Zoning\]/,/^$/ {
  if(/^cfg./){
    split($0,cfgparts,":");
    gsub(/^cfg./,"",cfgparts[1]);
    cfg[cfgparts[1]]=cfgparts[2];
  }
  else if(/^zone./) {
    zonename=$0;
    gsub(/:.*$/,"",zonename);
    gsub(/^zone./,"",zonename);
    zonemembers=$0;
    gsub(/^[^:]*:/,"",zonemembers);
    zone[zonename]=zonemembers;
  }
  else if(/^alias./) {
    aliasname=$0;
    gsub(/:.*$/,"",aliasname);
    gsub(/^alias./,"",aliasname);
    aliasmembers=$0;
    gsub(/^[^:]*:/,"",aliasmembers);
    alias[aliasname]=aliasmembers;
    if(length(aliasname)>longestalias){
      longestalias=length(aliasname);
    }
  }
  else if(/^enable:/) {
    cfgenabled=$0;
    gsub(/^enable:/,"",cfgenabled);
  }
}
END {
  print "Config:",cfgenabled;
  split(cfg[cfgenabled],active_zones,";");
  for(active_zone in active_zones) {
    split(zone[active_zones[active_zone]],zone_members,";");
    asort(zone_members);
    print "Zone",active_zones[active_zone],"(",length(zone_members),"Members ):";
    for(zone_member in zone_members){
      member=zone_members[zone_member];
      if(alias[member]!=""){
member=alias[member];
      }
      WWN=member;
      gsub(/:/,"",WWN);
      if(WWN ~ /^5/){start=2;}else{start=5;}
      vendor_id=substr(WWN,start,6);
      printf "  Member: %s\t",member;
      if(alias[zone_members[zone_member]]!=""){
        format=sprintf("%%s%%%ds\t",longestalias-length(zone_members[zone_member]));
        printf format,zone_members[zone_member]," ";
      }
      printf "%s\n",vendor[vendor_id];
    }
  }
  printf "\n\n\nCreate config:\n-------------------------------------------------\n";
  printf "cfgdelete  \"%s\"\n",cfgenabled;
  for(active_zone in active_zones) {
    split(zone[active_zones[active_zone]],zone_members,";");
    asort(zone_members);
    for(zone_member in zone_members){
      member=zone_members[zone_member];
      if(alias[member]!=""){
        printf "alicreate  \"%s\",\"%s\"\n",member,alias[member];
alias[member]="";
      }
    }
    printf "zonecreate \"%s\",\"%s\"\n",active_zones[active_zone],zone[active_zones[active_zone]];
    if(!secondelement){
      secondelement=1;
      printf "cfgcreate";
    } else {
      printf "cfgadd  ";
    }
    printf "  \"%s\",\"%s\"\n",cfgenabled,active_zones[active_zone];
  }
  printf "cfgsave\ncfgenable  \"%s\"\n",cfgenabled;
}
</syntaxhighlight>
=Kommandos: NetApp=
==fcp topology show : Wo hängt mein Frontend-SAN?==
<syntaxhighlight lang=bash>
fas01> fcp topology show
Switches connected on adapter 0d:
None connected.
Switches connected on adapter 0c:
None connected.
Switches connected on adapter 1a:
  Switch Name: fcsw01
Switch Vendor: Brocade Communications, Inc.
Switch Release: v6.4.2a
Switch Domain: 1
    Switch WWN: 10:00:00:05:33:c6:1e:6c
    Port Count: 24
Switches connected on adapter 1b:
  Switch Name: fcsw02
Switch Vendor: Brocade Communications, Inc.
Switch Release: v6.4.2a
Switch Domain: 1
    Switch WWN: 10:00:00:05:33:c7:5e:d2
    Port Count: 24
Switches connected on adapter 1c:
None connected.
Switches connected on adapter 1d:
None connected.
</syntaxhighlight>
==fcp config <port> : Welche WWN habe ich?==
<syntaxhighlight lang=bash>
fas01> fcp config 1a   
1a:  ONLINE <ADAPTER UP>  PTP  Fabric 
        host address 010600
        portname 50:0a:09:83:90:00:29:24  nodename 50:0a:09:80:80:00:29:24
        mediatype auto speed auto
</syntaxhighlight>
Kleines Schmankerl ist noch die "host address", die uns zeigt, daß wir auf Switch-ID 01 Port 06 hängen.
==fcp wwpn-alias (set|show) : Aliasnamen für mehr Klarheit beim Debugging==
<syntaxhighlight lang=bash>
fas01> fcp wwpn-alias set sun07_Slot2_Port0  21000024ff363a5a
fas01> fcp wwpn-alias show                                     
WWPN Alias
---- -----
21:00:00:24:ff:36:3a:5a sun07_Slot2_Port0
</syntaxhighlight>
==sanlun lun show -d <dev> (mit Solaris und ZPool)==
Wenn man wissen möchte, welche NetApp LUNs zu einem ZPool gehören, geht das folgender Maßen:
<syntaxhighlight lang=bash>
# zpool status | nawk '/c[0-9]t/{dev=$1;gsub(/s[0-9]+$/,"",$1);command="/opt/NTAP/SANToolkit/bin/sanlun lun show -d /dev/rdsk/"$1"s2";command | getline; command | getline; print dev,$1$2;next;}{print;}'
</syntaxhighlight>
Beispiel:
<syntaxhighlight lang=bash>
# zpool status | nawk '/c[0-9]t/{dev=$1;gsub(/s[0-9]+$/,"",$1);command="/opt/NTAP/SANToolkit/bin/sanlun lun show -d /dev/rdsk/"$1"s2";command | getline; command | getline; print dev,$1$2;next;}{print;}'
  Pool: testpool
Status: ONLINE
scan: resilvered 11,0G in 0h1m with 0 errors on Thu Oct  2 09:41:39 2014
config:
        NAME                                        STATE    READ WRITE CKSUM
        testpool                                    ONLINE      0    0    0
          mirror-0                                  ONLINE      0    0    0
c5t60A98000433544625634696B76705370d0s0 fas01:/vol/testlun/LUN0
c5t60A980003830304F392446473844375Ad0 fas02:/vol/testlun/LUN0
</syntaxhighlight>
=Sonstiges=
==Alle WWNs in einem File finden==
Gibt nur die WWNs aus, auch mehrere, wenn mehrere in einer Zeile sind.
<syntaxhighlight lang=awk>
gawk '{line=$0;while(match(line,/[0-9a-f]{2}(:[0-9a-f]{2}){7}/,wwn)){line=substr(line,wwn[0,"start"]+wwn[0,"length"]); print wwn[0];}}' <file>
</syntaxhighlight>
==Some adittions to NetApps sanlun lun show on Solaris==
<syntaxhighlight lang=awk>
# /opt/NTAP/SANToolkit/bin/sanlun lun show | gawk '
$3 ~ /\/dev\// {
  sanlun=$0;
  cmd="luxadm display "$3;
  while( cmd|getline line ){
    count=split(line,word);
    if(line ~ /DEVICE PROPERTIES for disk:/){
      disk=word[count];
      ctrl="";
      dev_addr="";
      svm_ports="";
      delete ports;
      delete pri;
      delete sec;
      delete paths;
      delete online;
      continue;
    }
    if(line ~ /Controller/){
      ctrl=word[count];
      continue;
    }
    if(line ~ /Device Address/){
      dev_addr=word[count];
      gsub(/,.*$/,"",dev_addr);
      ports[dev_addr]=1;
      pair=ctrl"_"dev_addr;
      continue;
    }
    if(line ~ /Class/){
      class[pair]=word[count];
      if(word[count]=="primary"){
        pri[disk]++;
      } else {
        sec[disk]++;
      }
      continue;
    }
    if(line ~ /State/){
      state[pair]=word[count];
      paths[disk]++;
      if(word[count]=="ONLINE"){
        online[disk]++;
      }
    }
    if(line ~ /^$/ && ctrl!=""){
      for(port in ports){
        if(svm_ports==""){
          sep="";
        } else {
          sep=",";
        }
        svm_ports=svm_ports sep port;
      }
      printf "%s      %2d/%2d        %2d/%2d        %s\n",sanlun,online[disk],paths[disk],pri[disk],sec[disk], svm_ports;
    }
  }
  close(cmd);
  next;
}
/^vserver/{
  line=sprintf("%s  Online/Total Primary/Secondary Device Addresses\n", $0);
  printf line;
  gsub(/./,"-",line);
  print line;
  next;
}
/^[-]+$/{next;}
{print;}
'
</syntaxhighlight>

Latest revision as of 16:50, 25 November 2021

Fibrechannel Analyse

Kommandos : Solaris

luxadm

luxadm -e port

Gibt die Hardwarepfade der vorhandened Fibrechannelports und deren Status aus:

# luxadm -e port
/devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl        CONNECTED
/devices/pci@79,0/pci10de,378@b/pci1077,143@0,1/fp@0,0:devctl      NOT CONNECTED
/devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:devctl        CONNECTED
/devices/pci@79,0/pci10de,376@e/pci1077,143@0,1/fp@0,0:devctl      NOT CONNECTED
2 Dualport Karten:
/devices/pci@79,0/pci10de,378@b/pci1077,143@0 und ...,1
/devices/pci@79,0/pci10de,376@e/pci1077,143@0 und ...,1
# prtdiag -v | head -1
System Configuration: Sun Microsystems     Sun Fire X4440

Aus der Seite Sun x86 Platforms: Matrix of Recognized Device Paths (Doc ID 1277396.1) (Oracle Support Login benötigt):

Sun Fire x4440 (Tucana)
PCI:
PCIe SLOT0         /pci@0,0/pci10de,375@f/pci1000,3150@0 // with PCI Express 8-Port SAS/SATA HBA
PCIe SLOT0         /pci@0,0/pci10de,375@f/               // without PCI Express 8-Port SAS/SATA HBA
PCIe SLOT1         /pci@0,0/pci10de,376@e/
PCIe SLOT2         /pci@7c,0/pci10de,377@f/
PCIe SLOT3         /pci@0,0/pci10de,377@a/
PCIe SLOT4         /pci@7c,0/pci10de,376@e/
PCIe SLOT5         /pci@7c,0/pci10de,378@b/
(7c can be renamed something else depending on BIOS/OS version)

Also stecken unsere Karten in Slot 4 und 5.

luxadm -e dump_map <HW_path>

Gibt die Tabelle der bekannten Geräte an einem Port aus

# luxadm -e dump_map /devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl
Pos  Port_ID Hard_Addr Port WWN         Node WWN         Type
0    30200   0        202600a0b86e10e4 200600a0b86e10e4 0x0  (Disk device)
1    30600   0        202700a0b86e10e4 200600a0b86e10e4 0x0  (Disk device)
2    10100   0        203400a0b85bb030 200400a0b85bb030 0x0  (Disk device)
3    10500   0        203500a0b85bb030 200400a0b85bb030 0x0  (Disk device)
4    10200   0        202600a0b86e103c 200600a0b86e103c 0x0  (Disk device)
5    11400   0        202700a0b86e103c 200600a0b86e103c 0x0  (Disk device)
6    30100   0        203200a0b85aeb2d 200200a0b85aeb2d 0x0  (Disk device)
7    30500   0        203300a0b85aeb2d 200200a0b85aeb2d 0x0  (Disk device)
8    10800   0        2100001b32902d45 2000001b32902d45 0x1f (Unknown Type,Host Bus Adapter)

Erklärung der interessanten Spalten:

  • Port_ID <Switch_ID><Switchport><??>
Es sind also offensichtlich 2 Switches in der Fabric an Port /devices/pci@79,0/pci10de,378@b/pci1077,143@0/fp@0,0:devctl
und zwar mit der ID 1 und mit der ID 3.
Switch ID 1
 Port 1 und  5 : Node WWN 200400a0b85bb030
 Port 2 und 14 : Node WWN 200600a0b86e103c
 Port 8        : Node WWN 2000001b32902d45 (Wir selbst)
Switch ID 3
 Port 1 und  5 : Node WWN 200200a0b85aeb2d
 Port 2 und  6 : Node WWN 200600a0b86e10e4 

Wir hängen also mit 2 Storages auf dem Switch mit der ID 1 und haben eine Verbindung zu einem Switch mit der ID 3 an dem 2 weitere Storages hängen.
  
  • Node WWN
Wir sehen hier 4 Disk Devices mit jeweils 2 Einträgen (Gleiche Node WWN)
  • Port WWN
Dies ist die Port WWN der an den Switch angeschlossenen Geräte (unter 8 finden wir uns selbst).
Pro Storage sehen wir hier 2 Port WWNs, also 2 Pfade über unseren einen Hostport.

Daher nachher 4 Pfade (2 Pro Hostport) beim #mpathadm list lu.

  • Type
Disk Device: Storage
Host Bus Adapter: FC-Karte

luxadm -e rdls <HW_path>

# luxadm -e port 2>/dev/null | awk '{print $1;}' | xargs -n 1 luxadm -e rdls 2>/dev/null

Link Error Status information for loop:/devices/pci@0,0/pci8086,340e@7/pci111d,806e@0/pci111d,806e@2/pci1077,143@0/fp@0,0:devctl
al_pa   lnk fail    sync loss   signal loss   sequence err   invalid word   CRC
30200   2           1           0             0              0              0           
30600   2           1           0             0              0              0           
10200   1           1           0             0              0              0           
11400   2           1           0             0              0              0           
10b00   0           0           0             0              0              0           
NOTE: These LESB counts are not cleared by a reset, only power cycles.
These counts must be compared to previously read counts.

Link Error Status information for loop:/devices/pci@0,0/pci8086,340e@7/pci111d,806e@0/pci111d,806e@2/pci1077,143@0,1/fp@0,0:devctl
al_pa   lnk fail    sync loss   signal loss   sequence err   invalid word   CRC
0       0           0           0             0              0              0           
NOTE: These LESB counts are not cleared by a reset, only power cycles.
These counts must be compared to previously read counts.

luxadm probe

Auflistung aller erkannten Fibrechanneldevices

#> luxadm probe

Found Fibre Channel device(s):
  Node WWN:200600a0b86e10e4  Device Type:Disk device
    Logical Path:/dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
...

luxadm display <Diskpath|WWN>

#>  luxadm display /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
  Vendor:               SUN
  Product ID:           STK6580_6780
  Revision:             0784
  Serial Num:           SP01068442
  Unformatted capacity: 204800.000 MBytes
  Write Cache:          Enabled
  Read Cache:           Enabled
    Minimum prefetch:   0x300
    Maximum prefetch:   0x0
  Device Type:          Disk device
  Path(s):

  /dev/rdsk/c8t600A0B80006E10E40000DC1C52E8B751d0s2
  /devices/scsi_vhci/disk@g600a0b80006e10e40000dc1c52e8b751:c,raw
   Controller           /dev/cfg/c4
    Device Address              202600a0b86e10e4,5
    Host controller port WWN    2100001b328a417f
    Class                       primary
    State                       ONLINE
   Controller           /dev/cfg/c4
    Device Address              202700a0b86e10e4,5
    Host controller port WWN    2100001b328a417f
    Class                       secondary
    State                       STANDBY
   Controller           /dev/cfg/c6
    Device Address              201600a0b86e10e4,5
    Host controller port WWN    2100001b32904445
    Class                       primary
    State                       ONLINE
   Controller           /dev/cfg/c6
    Device Address              201700a0b86e10e4,5
    Host controller port WWN    2100001b32904445
    Class                       secondary
    State                       STANDBY
  • Vendor: SUN
Hersteller
  • Product ID: STK6580_6780
Also ein StorageTek 6580/6780
  • Revision: 0784
Grobe Firmwarepeilung (Firmware Version: 07.84.47.10)

Siehe hier #lsscs list array <array_name>

  • Serial Num: SP01068442
Praktisch, wenn man mit NetApps arbeitet, um die LUNs zuzuordnen.
  • Unformatted capacity: 204800.000 MBytes
Immer gut zu wissen
  • Write Cache: Enabled
Die Batterie im Storage sollte also OK sein ;-)
  • Path(s):
Rawdevicepath
Hardwaredevicepath
Jetzt folgen immer pro Pfad zu diesem Device ein Block aus
 Controller      (siehe unten)
 Device Address  <Port WWN vom Device>,<LUN ID>
 Class           <primary|secondary> (siehe unten)
 State           <Online|Standby|Oflline>

Zuweisung Controller zum FC-Port über:

# ls -al /dev/cfg/c6
lrwxrwxrwx   1 root     root          60 Sep  3  2009 /dev/cfg/c6 -> ../../devices/pci@79,0/pci10de,376@e/pci1077,143@0/fp@0,0:fc

Man sieht den Hardwarepfad von #luxadm -e port

Class:

Via ALUA (Asymmetric Logical Unit Access) teilt das Device dem Host mit, über welche Pfade der Host primär auf die LUN zugreifen soll.

fcinfo

fcinfo hba-port

Gibt ein paar Infos über Hersteller, Modell, Firmware, Port und Node WWN, Current Speed, ... aus

#> fcinfo hba-port
HBA Port WWN: 2100001b328a417f
        OS Device Name: /dev/cfg/c4
        Manufacturer: QLogic Corp.
        Model: 375-3356-02
        Firmware Version: 05.06.00
        FCode/BIOS Version:  BIOS: 2.02; fcode: 2.01; EFI: 2.00;
        Serial Number: 0402R00-0918701860
        Driver Name: qlc
        Driver Version: 20110825-3.06
        Type: N-port
        State: online
        Supported Speeds: 1Gb 2Gb 4Gb
        Current Speed: 4Gb
        Node WWN: 2000001b328a417f
HBA Port WWN: 2101001b32aa417f
        OS Device Name: /dev/cfg/c5
        Manufacturer: QLogic Corp.
        Model: 375-3356-02
        Firmware Version: 05.06.00
        FCode/BIOS Version:  BIOS: 2.02; fcode: 2.01; EFI: 2.00;
        Serial Number: 0402R00-0918701860
        Driver Name: qlc
        Driver Version: 20110825-3.06
        Type: unknown
        State: offline
        Supported Speeds: 1Gb 2Gb 4Gb
        Current Speed: not established
        Node WWN: 2001001b32aa417f
HBA Port WWN: 2100001b32904445
        OS Device Name: /dev/cfg/c6
        Manufacturer: QLogic Corp.
        Model: 375-3356-02
        Firmware Version: 05.06.00
        FCode/BIOS Version:  BIOS: 2.02; fcode: 2.01; EFI: 2.00;
        Serial Number: 0402R00-0918701887
        Driver Name: qlc
        Driver Version: 20110825-3.06
        Type: N-port
        State: online
        Supported Speeds: 1Gb 2Gb 4Gb
        Current Speed: 4Gb
        Node WWN: 2000001b32904445
HBA Port WWN: 2101001b32b04445
        OS Device Name: /dev/cfg/c7
        Manufacturer: QLogic Corp.
        Model: 375-3356-02
        Firmware Version: 05.06.00
        FCode/BIOS Version:  BIOS: 2.02; fcode: 2.01; EFI: 2.00;
        Serial Number: 0402R00-0918701887
        Driver Name: qlc
        Driver Version: 20110825-3.06
        Type: unknown
        State: offline
        Supported Speeds: 1Gb 2Gb 4Gb
        Current Speed: not established
        Node WWN: 2001001b32b04445

fcinfo remote-port --port <HBA Port WWN> --linkstat

# fcinfo remote-port --port 2100001b32904445 --linkstat
Remote Port WWN: 201600a0b86e103c
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200600a0b86e103c
        Link Error Statistics:
                Link Failure Count: 3
                Loss of Sync Count: 3
                Loss of Signal Count: 2
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 201700a0b86e103c
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200600a0b86e103c
        Link Error Statistics:
                Link Failure Count: 4
                Loss of Sync Count: 261
                Loss of Signal Count: 4
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 202200a0b85aeb2d
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200200a0b85aeb2d
        Link Error Statistics:
                Link Failure Count: 2
                Loss of Sync Count: 1
                Loss of Signal Count: 2
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 202300a0b85aeb2d
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200200a0b85aeb2d
        Link Error Statistics:
                Link Failure Count: 2
                Loss of Sync Count: 1
                Loss of Signal Count: 2
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 201600a0b86e10e4
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200600a0b86e10e4
        Link Error Statistics:
                Link Failure Count: 3
                Loss of Sync Count: 1
                Loss of Signal Count: 0
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 201700a0b86e10e4
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200600a0b86e10e4
        Link Error Statistics:
                Link Failure Count: 3
                Loss of Sync Count: 1
                Loss of Signal Count: 0
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 202400a0b85bb030
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200400a0b85bb030
        Link Error Statistics:
                Link Failure Count: 2
                Loss of Sync Count: 1
                Loss of Signal Count: 2
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0
Remote Port WWN: 202500a0b85bb030
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 200400a0b85bb030
        Link Error Statistics:
                Link Failure Count: 2
                Loss of Sync Count: 1
                Loss of Signal Count: 3
                Primitive Seq Protocol Error Count: 0
                Invalid Tx Word Count: 0
                Invalid CRC Count: 0

fcinfo remote-port --port <HBA Port WWN> --scsi-target

# fcinfo hba-port | grep HBA
HBA Port WWN: 21000024ff3cf472
HBA Port WWN: 21000024ff3cf473
HBA Port WWN: 21000024ff3cf454
HBA Port WWN: 21000024ff3cf455

# fcinfo remote-port --port 21000024ff3cf472 --scsi-target
Remote Port WWN: 20110002ac0059ce
        Active FC4 Types: SCSI
        SCSI Target: yes
        Node WWN: 2ff70002ac0059ce
        LUN: 0
          Vendor: 3PARdata
          Product: VV              
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000002000059CEd0s2
        LUN: 1
          Vendor: 3PARdata
          Product: VV              
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000003000059CEd0s2
        LUN: 2
          Vendor: 3PARdata
          Product: VV              
          OS Device Name: /dev/rdsk/c6t60002AC00000000000000004000059CEd0s2
...

fcinfo lu -v <device>

# fcinfo lu -v /dev/rdsk/c0t60030D90D9DD1A059655804D4A5EAD2Ed0s2
OS Device Name: /dev/rdsk/c0t60030D90D9DD1A059655804D4A5EAD2Ed0s2
        HBA Port WWN: 2100000e1ed89451
        Controller: /dev/cfg/c4
                Remote Port WWN: 2100f4e9d4564d21
                        LUN: 11
                        State: active/optimized
                Remote Port WWN: 2100f4e9d4564c97
                        LUN: 11
                        State: active/non-optimized
        HBA Port WWN: 2100000e1ed89450
        Controller: /dev/cfg/c3
                Remote Port WWN: 2100f4e9d4564d44
                        LUN: 11
                        State: active/optimized
                Remote Port WWN: 2100f4e9d4564c1c
                        LUN: 11
                        State: active/non-optimized
        Vendor: DataCore
        Product: Virtual Disk    
        Device Type: Disk Device
        Unformatted capacity: 204800.000 MBytes

mpathadm

mpathadm list lu

cfgadm

cfgadm -al -o show_FCP_dev [<controller>]

# cfgadm -al -o show_FCP_dev  | grep unusable
c8::21000024ff2d49a2,0         disk         connected    configured   unusable
c8::21000024ff2d49a2,1         disk         connected    configured   unusable
c8::21000024ff2d49a2,2         disk         connected    configured   unusable
c8::21000024ff2d49a2,3         disk         connected    configured   unusable
c8::21000024ff2d49a2,4         disk         connected    configured   unusable
c8::21000024ff2d49a2,5         disk         connected    configured   unusable
c8::21000024ff2d49a2,6         disk         connected    configured   unusable
c8::21000024ff2d49a2,7         disk         connected    configured   unusable
c8::21000024ff2d49a2,8         disk         connected    configured   unusable
c8::21000024ff2d49a2,9         disk         connected    configured   unusable
c8::21000024ff2d49a2,10        disk         connected    configured   unusable
c9::203400a0b839c421,31        disk         connected    configured   unusable
c9::203400a0b84913d2,31        disk         connected    configured   unusable
c9::203500a0b839c421,31        disk         connected    configured   unusable
c9::203500a0b84913d2,31        disk         connected    configured   unusable

cfgadm -c unconfigure -o unusable_SCSI_LUN <unusable device>

# cfgadm -c unconfigure -o unusable_SCSI_LUN c8::21000024ff2d49a2

Alle aufräumen:

# cfgadm -alo show_SCSI_LUN | nawk '$NF=="unusable"{gsub(/,[0-9]+$/,"",$1);print $1}' | sort -u | xargs -n 1 cfgadm -c unconfigure -o unusable_SCSI_LUN

cfgadm -o force_update -c configure <controller>

Rescan LUNs. Be careful! Does a forcelip!

# cfgadm -o force_update -c configure c10


prtconf -Da <device>

# prtconf -Da /dev/cfg/c3 
i86pc (driver name: rootnex)
    pci, instance #0 (driver name: npe)
        pci8086,3410, instance #5 (driver name: pcieb)
            pci111d,806e, instance #12 (driver name: pcieb)
                pci111d,806e, instance #13 (driver name: pcieb)
                    pci1077,170, instance #0 (driver name: qlc)  <---
                        fp, instance #0 (driver name: fp)


LUN masking (access LUNs of a storage)

Nov  6 13:44:59 server01         Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@380/pci@1/pci@0/pci@5/SUNW,qlc@0/fp@0,0/ssd@w204300a096691217,7 (ssd7):
Nov  6 13:44:59 server01         Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@380/pci@1/pci@0/pci@5/SUNW,qlc@0/fp@0,0/ssd@w204300a096691217,7 (ssd7):
Nov  6 13:44:59 server01         Corrupt label; wrong magic number
Nov  6 13:44:59 server01 cmlb: WARNING: /pci@300/pci@1/pci@0/pci@4/SUNW,qlc@0/fp@0,0/ssd@w203300a096691217,7 (ssd2):
Nov  6 13:44:59 server01         Corrupt label; wrong magic number
...
# cat /etc/driver/drv/fp.conf
mpxio-disable="no";
pwwn-lun-blacklist=
"203200a096691265,7",
"203300a096691265,7",
"204200a096691265,7",
"204300a096691265,7",
"203200a096691217,7",
"203300a096691217,7",
"204200a096691217,7",
"204300a096691217,7";
# reboot -- -r
...
Boot device: /pci@300/pci@1/pci@0/pci@2/scsi@0/disk@p0  File and args: -r
SunOS Release 5.11 Version 11.3 64-bit
Copyright (c) 1983, 2015, Oracle and/or its affiliates. All rights reserved.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203300a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203200a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203300a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 203200a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204300a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204200a096691217 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204300a096691265 is masked due to black listing.
/pseudo/fcp@0 (fcp0):
        LUN 7 of port 204200a096691265 is masked due to black listing.
Configuring devices.

Kommandos : Common Array Manager

lsscs

Ist unter Solaris in /opt/SUNWsefms/bin

lsscs list array

lsscs list array <array_name>

lsscs list -a <array_name> fcport

Kommandos : Brocade

Switch-Kommandos

switchshow

san-sw_11:admin> switchshow
switchName:	san-sw_11
switchType:	71.2
switchState:	Online   
switchMode:	Native
switchRole:	Principal
switchDomain:	1
switchId:	fffc01
switchWwn:	10:00:00:05:33:df:43:5a
zoning:		ON (Fabric1)
switchBeacon:	OFF

Index Port Address Media Speed State     Proto
==============================================
   0   0   010000   id     N8   No_Light    FC  
   1   1   010100   id     N8   Online      FC  E-Port  10:00:00:05:33:df:bd:b9 "san-sw_21" (downstream)
   2   2   010200   id     N8   Online      FC  F-Port  21:00:00:24:ff:05:74:e4 
   3   3   010300   id     N8   Online      FC  F-Port  50:0a:09:81:8d:32:5d:c4 
   4   4   010400   id     N8   No_Light    FC  
   5   5   010500   id     N8   Online      FC  E-Port  10:00:00:05:33:df:bd:b9 "san-sw_21" 
   6   6   010600   id     N4   Online      FC  F-Port  20:06:00:a0:b8:32:38:17 
   7   7   010700   id     N4   Online      FC  F-Port  20:07:00:a0:b8:32:38:17 
   8   8   010800   id     N4   Online      FC  F-Port  21:00:00:1b:32:91:4c:ed 
   9   9   010900   id     N4   Online      FC  F-Port  21:00:00:1b:32:98:05:1a 
  10  10   010a00   id     N8   Online      FC  F-Port  21:00:00:24:ff:4a:d3:bc 
  11  11   010b00   id     N8   No_Light    FC  
  12  12   010c00   id     N8   No_Light    FC  
  13  13   010d00   id     N8   No_Light    FC  
  14  14   010e00   id     N8   No_Light    FC  
  15  15   010f00   id     N8   No_Light    FC  
  16  16   011000   --     N8   No_Module   FC  (No POD License) Disabled
  17  17   011100   --     N8   No_Module   FC  (No POD License) Disabled
  18  18   011200   --     N8   No_Module   FC  (No POD License) Disabled
  19  19   011300   --     N8   No_Module   FC  (No POD License) Disabled
  20  20   011400   --     N8   No_Module   FC  (No POD License) Disabled
  21  21   011500   --     N8   No_Module   FC  (No POD License) Disabled
  22  22   011600   --     N8   No_Module   FC  (No POD License) Disabled
  23  23   011700   --     N8   No_Module   FC  (No POD License) Disabled

Was sagt uns das?

  1. Dies ist der "Principal" (alle andere sind "Subordinate") der Fabric "Fabric1" (switchRole:, zoning:)
  2. Der Switch ist gezoned (zoning:)
  3. SwitchID ist "fffc01"
  4. Es ist ein 24-Port Switch
  5. Es gibt einen doppelten ISL (InterSwitchLink) zu einem anderen Switch E-Port (san-sw_21)
  6. 6 Ports sind mit SFPs bestückt, aber nicht belegt (0,4,11-15)
  7. 8 Ports haben keine Lizenz und auch kein SFP (No_Module)
  8. 9 Ports sind belegt

fabricshow

san-sw_11:root> fabricshow
Switch ID   Worldwide Name           Enet IP Addr    FC IP Addr      Name
-------------------------------------------------------------------------
  1: fffc01 10:00:00:05:33:df:43:5a 192.168.1.117 0.0.0.0          >"san-sw_11"
  2: fffc02 10:00:00:05:33:df:bd:b9 192.168.1.119 0.0.0.0           "san-sw_21"

The Fabric has 2 switches

islshow

rz1_fab2_11:admin> islshow 
  1:  1->  0 10:00:00:05:1e:0d:5e:96  12 bc1_sl4_fab2_12 sp:  4.000G bw:  4.000G 
  2:  2->  0 10:00:00:05:1e:0d:e2:53  13 bc2_sl4_fab2_13 sp:  4.000G bw:  4.000G 
  3:  3->  0 10:00:00:05:1e:b3:71:bf  14 bc3_sl4_fab2_14 sp:  4.000G bw:  4.000G 
  4:  5-> 17 10:00:00:05:1e:0d:5e:96  12 bc1_sl4_fab2_12 sp:  4.000G bw:  4.000G 
  5:  6-> 17 10:00:00:05:1e:0d:e2:53  13 bc2_sl4_fab2_13 sp:  4.000G bw:  4.000G 
  6:  7-> 17 10:00:00:05:1e:b3:71:bf  14 bc3_sl4_fab2_14 sp:  4.000G bw:  4.000G 
  7: 10->  8 10:00:50:eb:1a:45:71:96  15 rz-6510-fab2-15 sp:  4.000G bw:  4.000G 
  8: 18->  0 10:00:50:eb:1a:45:71:96  15 rz-6510-fab2-15 sp:  4.000G bw:  4.000G

Port-Kommandos

porterrshow

portstatsshow

portstatsclear

portloginshow

Show information about NPIV-ports.

fcsw1:admin> switchshow       
...
Index Port Address Media Speed       State   Proto
==================================================
...
  34  34   0f2200   id    N16	   Online      FC  F-Port  1 N Port + 1 NPIV public 
...

This is a NetApp 8080 with CDOT behind this port as you can see with nodefind <address>

fcsw1:admin> nodefind 0f2200
Local:
 Type Pid    COS     PortName                NodeName                 SCR
 N    0f2200;      3;50:0a:09:82:80:d1:21:ee;50:0a:09:80:80:d1:21:ee; 0x00000000
    PortSymb: [45] "NetApp FC Target Adapter (8324) cdot1-01:0g"
    NodeSymb: [38] "NetApp FAS8080 (cdot1-01/cdot1-02)"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45 
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: Physical Unknown(initiator/target)
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No 
    Partial: No
    LSAN: No
    Aliases:

Now look with portloginshow <portnumber>:

fcsw1:admin> portloginshow 34    
Type  PID     World Wide Name        credit df_sz cos
=====================================================
  fd  0f2201 20:00:00:a0:98:5d:33:82     6  2048   8  scr=0x3
  fe  0f2200 50:0a:09:82:80:d1:21:ee     6  2048   8  scr=0x0
  ff  0f2201  20:00:00:a0:98:5d:33:82     0     0   8  d_id=FFFFFC  
  ff  0f2200  50:0a:09:82:80:d1:21:ee     0     0   8  d_id=FFFFFC

With this information you can find out more about the WWNs:

fcsw1:admin> nodefind 20:00:00:a0:98:5d:33:82
Local:
 Type Pid    COS     PortName                NodeName                 SCR
 N    0f2201;      3;20:00:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP 
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-01_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45 
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: NPIV Target
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No 
    Partial: No
    LSAN: No
    Aliases: cdot1fc_01_lif1

Even the VServer (NodeSymb)!

And with the NodeName you can find all logical interfaces of this svm:

fcsw1:admin> nodefind 20:04:00:a0:98:5d:33:82
Local:
 Type Pid    COS     PortName                NodeName                 SCR
 N    0f2201;      3;20:00:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP 
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-01_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:22:50:eb:1a:42:f8:45 
    Permanent Port Name: 50:0a:09:82:80:d1:21:ee
    Device type: NPIV Target
    Port Index: 34
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No 
    Partial: No
    LSAN: No
    Aliases: cdot1fc_01_lif1
 N    0f2301;      3;20:02:00:a0:98:5d:33:82;20:04:00:a0:98:5d:33:82; 0x00000003
    FC4s: FCP 
    PortSymb: [58] "NetApp FC Target Port (8324) cdot1fc:cdot1-02_fc_lif_1"
    NodeSymb: [24] "NetApp Vserver cdot1fc"
    Fabric Port Name: 20:23:50:eb:1a:42:f8:45 
    Permanent Port Name: 50:0a:09:82:80:61:21:e8
    Device type: NPIV Target
    Port Index: 35
    Share Area: No
    Device Shared in Other AD: No
    Redirect: No 
    Partial: No
    LSAN: No
    Aliases: cdot1fc_02_lif1

Zone-Kommandos

zoneshow

alicreate

alishow

Backup der Switchconfig per Script

Put the backup host ssh-pub-key on the switches

fcsw1:root> cat >/root/.ssh/authorized_keys <<EOF
> ssh-dss AAAAB3NzaC1...
...
...
lF8qsgtTD8cc= root@host
> EOF

Generate ssh-key on the switches

fcsw1:root> ssh-keygen  
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
2a:23:33:...:69:bc:25:a5:f9 root@fcsw1
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
| ...             |
|                 |
+-----------------+

Copy the key to your backup users ~/.ssh/authorized_keys on backup host

fcsw1:root> cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAA...
...
KHnw1T1NaQ== root@fcsw1

Now the script on the backup host

# cat /opt/bin/backup_brocade_config 
#!/bin/bash
SWITCHES="
172.30.40.50
172.30.40.51
"
LOCALUSER="backupuser"
BACKUPDIR="brocade_backup"
BACKUPHOST="172.30.40.10"

DATE="$(date '+%Y%m%d-%H%M%S')"
for switch in ${SWITCHES} ; do
  printf "Backing up ${switch} to ~${LOCALUSER}/${BACKUPDIR}/${switch}_config_${date}.txt... "
  ssh root@${switch} /fabos/link_sbin/configupload -all -p scp ${BACKUPHOST},${LOCALUSER},${BACKUPDIR}/${switch}_config_${DATE}.txt
done

Script zum parsen einer configupload-Datei

#!/usr/bin/gawk -f
BEGIN{
  vendor["001438"]="Hewlett-Packard";
  vendor["00a098"]="NetApp";
  vendor["0024ff"]="Qlogic";
  vendor["001b32"]="Qlogic";
  vendor["0000c9"]="Emulex";
  vendor["00e002"]="CROSSROADS SYSTEMS, INC.";
  
}
/\[Zoning\]/,/^$/ {
  if(/^cfg./){
    split($0,cfgparts,":");
    gsub(/^cfg./,"",cfgparts[1]);
    cfg[cfgparts[1]]=cfgparts[2];
  }
  else if(/^zone./) {
    zonename=$0;
    gsub(/:.*$/,"",zonename);
    gsub(/^zone./,"",zonename);
    zonemembers=$0;
    gsub(/^[^:]*:/,"",zonemembers);
    zone[zonename]=zonemembers;
  }
  else if(/^alias./) {
    aliasname=$0;
    gsub(/:.*$/,"",aliasname);
    gsub(/^alias./,"",aliasname);
    aliasmembers=$0;
    gsub(/^[^:]*:/,"",aliasmembers);
    alias[aliasname]=aliasmembers;
    if(length(aliasname)>longestalias){
      longestalias=length(aliasname);
    }
  }
  else if(/^enable:/) {
    cfgenabled=$0;
    gsub(/^enable:/,"",cfgenabled);
  }
}
END {
  print "Config:",cfgenabled;
  split(cfg[cfgenabled],active_zones,";");
  for(active_zone in active_zones) {
    split(zone[active_zones[active_zone]],zone_members,";");
    asort(zone_members);
    print "Zone",active_zones[active_zone],"(",length(zone_members),"Members ):";
    for(zone_member in zone_members){
      member=zone_members[zone_member];
      if(alias[member]!=""){
	member=alias[member];
      }
      WWN=member;
      gsub(/:/,"",WWN);
      if(WWN ~ /^5/){start=2;}else{start=5;}
      vendor_id=substr(WWN,start,6);
      printf "  Member: %s\t",member;
      if(alias[zone_members[zone_member]]!=""){
        format=sprintf("%%s%%%ds\t",longestalias-length(zone_members[zone_member]));
        printf format,zone_members[zone_member]," ";
      }
      printf "%s\n",vendor[vendor_id];
    }
  }
  printf "\n\n\nCreate config:\n-------------------------------------------------\n";
  printf "cfgdelete  \"%s\"\n",cfgenabled;
  for(active_zone in active_zones) {
    split(zone[active_zones[active_zone]],zone_members,";");
    asort(zone_members);
    for(zone_member in zone_members){
      member=zone_members[zone_member];
      if(alias[member]!=""){
        printf "alicreate  \"%s\",\"%s\"\n",member,alias[member];
	alias[member]="";
      }
    }
    printf "zonecreate \"%s\",\"%s\"\n",active_zones[active_zone],zone[active_zones[active_zone]];
    if(!secondelement){
      secondelement=1;
      printf "cfgcreate";
    } else {
      printf "cfgadd   ";
    }
    printf "  \"%s\",\"%s\"\n",cfgenabled,active_zones[active_zone];
  }
  printf "cfgsave\ncfgenable  \"%s\"\n",cfgenabled;
}

Kommandos: NetApp

fcp topology show : Wo hängt mein Frontend-SAN?

fas01> fcp topology show
Switches connected on adapter 0d:
	None connected.

Switches connected on adapter 0c:
	None connected.

Switches connected on adapter 1a:

   Switch Name: fcsw01
 Switch Vendor: Brocade Communications, Inc.
Switch Release: v6.4.2a
 Switch Domain: 1
    Switch WWN: 10:00:00:05:33:c6:1e:6c
    Port Count: 24

Switches connected on adapter 1b:

   Switch Name: fcsw02
 Switch Vendor: Brocade Communications, Inc.
Switch Release: v6.4.2a
 Switch Domain: 1
    Switch WWN: 10:00:00:05:33:c7:5e:d2
    Port Count: 24

Switches connected on adapter 1c:
	None connected.

Switches connected on adapter 1d:
	None connected.

fcp config <port> : Welche WWN habe ich?

fas01> fcp config 1a    
1a:   ONLINE <ADAPTER UP>  PTP  Fabric  
        host address 010600
        portname 50:0a:09:83:90:00:29:24  nodename 50:0a:09:80:80:00:29:24
        mediatype auto speed auto

Kleines Schmankerl ist noch die "host address", die uns zeigt, daß wir auf Switch-ID 01 Port 06 hängen.

fcp wwpn-alias (set|show) : Aliasnamen für mehr Klarheit beim Debugging

fas01> fcp wwpn-alias set sun07_Slot2_Port0  21000024ff363a5a
fas01> fcp wwpn-alias show                                      
WWPN				Alias
----				-----
21:00:00:24:ff:36:3a:5a		sun07_Slot2_Port0

sanlun lun show -d <dev> (mit Solaris und ZPool)

Wenn man wissen möchte, welche NetApp LUNs zu einem ZPool gehören, geht das folgender Maßen:

# zpool status | nawk '/c[0-9]t/{dev=$1;gsub(/s[0-9]+$/,"",$1);command="/opt/NTAP/SANToolkit/bin/sanlun lun show -d /dev/rdsk/"$1"s2";command | getline; command | getline; print dev,$1$2;next;}{print;}'

Beispiel:

# zpool status | nawk '/c[0-9]t/{dev=$1;gsub(/s[0-9]+$/,"",$1);command="/opt/NTAP/SANToolkit/bin/sanlun lun show -d /dev/rdsk/"$1"s2";command | getline; command | getline; print dev,$1$2;next;}{print;}'
  Pool: testpool
 Status: ONLINE
 scan: resilvered 11,0G in 0h1m with 0 errors on Thu Oct  2 09:41:39 2014
config:

        NAME                                         STATE     READ WRITE CKSUM
        testpool                                     ONLINE       0     0     0
          mirror-0                                   ONLINE       0     0     0
c5t60A98000433544625634696B76705370d0s0 fas01:/vol/testlun/LUN0
c5t60A980003830304F392446473844375Ad0 fas02:/vol/testlun/LUN0

Sonstiges

Alle WWNs in einem File finden

Gibt nur die WWNs aus, auch mehrere, wenn mehrere in einer Zeile sind.

gawk '{line=$0;while(match(line,/[0-9a-f]{2}(:[0-9a-f]{2}){7}/,wwn)){line=substr(line,wwn[0,"start"]+wwn[0,"length"]); print wwn[0];}}' <file>

Some adittions to NetApps sanlun lun show on Solaris

# /opt/NTAP/SANToolkit/bin/sanlun lun show | gawk '
$3 ~ /\/dev\// {
  sanlun=$0;
  cmd="luxadm display "$3;
  while( cmd|getline line ){
    count=split(line,word);
    if(line ~ /DEVICE PROPERTIES for disk:/){
      disk=word[count];
      ctrl="";
      dev_addr="";
      svm_ports="";
      delete ports;
      delete pri;
      delete sec;
      delete paths;
      delete online;
      continue;
    }
    if(line ~ /Controller/){
      ctrl=word[count];
      continue;
    }
    if(line ~ /Device Address/){
      dev_addr=word[count];
      gsub(/,.*$/,"",dev_addr);
      ports[dev_addr]=1;
      pair=ctrl"_"dev_addr;
      continue;
    }
    if(line ~ /Class/){
      class[pair]=word[count];
      if(word[count]=="primary"){
        pri[disk]++;
      } else {
        sec[disk]++;
      }
      continue;
    }
    if(line ~ /State/){
      state[pair]=word[count];
      paths[disk]++;
      if(word[count]=="ONLINE"){
        online[disk]++;
      }
    }
    if(line ~ /^$/ && ctrl!=""){
      for(port in ports){
        if(svm_ports==""){
          sep="";
        } else {
          sep=",";
        }
        svm_ports=svm_ports sep port;
      }
      printf "%s      %2d/%2d         %2d/%2d        %s\n",sanlun,online[disk],paths[disk],pri[disk],sec[disk], svm_ports;
    }
  }
  close(cmd);
  next;
}
/^vserver/{
  line=sprintf("%s  Online/Total Primary/Secondary Device Addresses\n", $0);
  printf line;
  gsub(/./,"-",line);
  print line;
  next;
}
/^[-]+$/{next;}
{print;}
'