Thursday, February 19, 2015

Managing disks in solaris 11.2

HI everyone ..You probably are here because you maybe searching ho to make ISCSI or FC luns avilable through Solaris OS.

We then i wont be talking much but lets start working.

Initially please proceed if you have the following things:

1) A solaris machine with lots of Hard drive of course  ;)

Thing we will be needing  are as follows :

1) Internet connection
2) Solaris OS
3) Oracle account
..
The procedure are as follows :

First make sure you have the repo downloaded and setup your Local IPS repo. IF not you can visit my blog that explains ho to do that . Its title is creating a local IPS Repo in solaris.

Assuming you have create your repo lets move forward .
The first thing you want to do is intall comstar .
Comstar is a protocal that will be very important to create luns of disks.

Installing Comstar:

target# pkg install group/feature/storage-server
              Packages to install:    75
           Create boot environment:    No
               Services to restart:     7
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                75/75   9555/9555  105.7/105.7

PHASE                                        ACTIONS
Install Phase                            13347/13347 

PHASE                                          ITEMS
Package State Update Phase                     75/75 
Image State Update Phase                         2/2 
Loading smf(5) service descriptions: 17/17
Loading smf(5) service descriptions: 3/3

PHASE                                          ITEMS
Reading Existing Index                           8/8 
Indexing Packages                              75/75
Indexing Packages                              75/75
Optimizing Index...

PHASE                                          ITEMS
Indexing Packages                            573/573 

Either reboot the system or enable the stmf service.
  1. target# svcadm enable stmf
    # svcs stmf
    STATE          STIME    FMRI
    online         09:42:32 svc:/system/stmf:default

Now assuming that your stmf service is live lets start creating disks pool.

Create a ZPOOL

target# zpool create (desired pool name ) (disk names you want to include)

now that your pool is created lets create a volume that you want to share .
target# zfs create -V 2g sanpool/vol1

  1. Create a LUN for the ZFS volume.
    target# stmfadm create-lu /dev/zvol/rdsk/sanpool/vol1
    Logical unit created: 600144F0B5418B0000004DDAC7C10001
    You can find the device path for the ZFS volume in the /dev/zvol/rdsk/pool-name/ directory.
  2. Confirm that the LUN has been created.
    target# stmfadm list-lu
    LU Name: 600144F0B5418B0000004DDAC7C10001
  3. Add the LUN view.
    This command makes the LUN accessible to all systems.
    target# stmfadm add-view 600144F0B5418B0000004DDAC7C10001
    If you want to restrict the LUN view to specific systems, see How to Restrict LUN Access to Selected Systems.
  4. Verify the LUN configuration.
    target# stmfadm list-view -l 600144F0B5418B0000004DDAC7C10001
    View Entry: 0
        Host group   : All
        Target group : All
        LUN          : 0
Now as your Luns are avilable you need to configure you ISCSI target lets folow the below tutorial:

How to Create the iSCSI Target

This procedure assumes that you are logged in to the local system will contains the iSCSI target.
  1. Enable the iSCSI target service.
    target# svcadm enable -r svc:/network/iscsi/target:default
    Confirm that the service is enabled.
    target# svcs -l iscsi/target
    fmri         svc:/network/iscsi/target:default
    name         iscsi target
    enabled      true
    state        online
    next_state   none
    state_time   Mon May 23 14:48:59 2011
    logfile      /var/svc/log/network-iscsi-target:default.log
    restarter    svc:/system/svc/restarter:default
    dependency   require_any/error svc:/milestone/network (online)
    dependency   require_all/none svc:/system/stmf:default (online)
  2. Create the iSCSI target.
    target# itadm create-target
    Target iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405 successfully created
  3. Display the iSCSI target information.
    target# itadm list-target -v
    TARGET NAME                                                  STATE    SESSIONS 
    iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405  online   0        
            alias:                  -
            auth:                   none (defaults)
            targetchapuser:         -
            targetchapsecret:       unset
            tpg-tags:               default
Now as you are ready with the luns and a Target we need to configure the inititor to find the provided luns.

How to Configure an iSCSI Initiator

Part of the initiator configuration process is to identify the iSCSI target discovery method, which presents an initiator with a list of available targets. You can configure iSCSI targets for static, SendTargets, or iSNS dynamic discovery. Dynamic discovery using the SendTargets option is the optimum configuration for an iSCSI initiator that accesses a large number of targets, such over an iSCSI to Fibre Channel bridge. SendTargets dynamic discovery requires the IP address and port combination of the iSCSI target for the iSCSI initiator to perform the target discovery. The most common discovery method is SendTargets.
When configuring the target discovery method, you must provide the following information, depending on which method you choose:
  • SendTargets – Target IP address
  • iSNS – iSNS server address
  • Static – Target IP address and target name
For more information about configuring target discovery methods, see Configuring Dynamic or Static Target Discovery.
  1. Enable the iSCSI initiator service.
    initiator# svcadm enable network/iscsi/initiator
  2. Verify the target's name and IP address while logged in to the server that is providing the target.
    target# ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    e1000g0/_b        dhcp     ok           10.80.227.189/24
    lo0/v6            static   ok           ::1/128
    e1000g0/_a        addrconf ok           fe80::214:4fff:fe27:360c/10
    target# itadm list-target -v
    TARGET NAME                                                  STATE    SESSIONS 
    iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405  online   0        
            alias:                  -
            auth:                   none (defaults)
            targetchapuser:         -
            targetchapsecret:       unset
            tpg-tags:               default
  3. Configure the target to be statically discovered.
    initiator# iscsiadm add static-config iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405,
    10.80.227.189
  4. Review the static configuration information.
    initiator# iscsiadm list static-config
    Static Configuration Target: iqn.1986-03.com.sun:02:73d12edc-9bb9-cb44-efc4-c3b36c039405,
    10.80.227.189:3260
    The iSCSI connection is not initiated until the discovery method is enabled. See the next step.
  5. Configure one of the following target discovery methods:
    • If you have configured a dynamically discovered (SendTargets) target, configure the SendTargets discovery method.
      initiator# iscsiadm add discovery-address 10.80.227.189
    • If you have configured a dynamically discovered (iSNS) target, configure the iSNS discovery method.
      initiator# iscsiadm add isns-server 10.80.227.189
  6. Enable one of the following the target discovery methods:
    • If you have configured a dynamically discovered (SendTargets) target, enable the SendTargets discovery method.
      initiator# iscsiadm modify discovery --sendtargets enable
    • If you have configured a dynamically discovered (iSNS) target, enable the iSNS discovery method.
      initiator# iscsiadm modify discovery --iSNS enable
    • If you have configured static targets, enable the static target discovery method.
      initiator# iscsiadm modify discovery --static enable
  7. Reconfigure the /dev namespace to recognize the iSCSI disk, if necessary.
    initiator# devfsadm -i iscsi

Now you are ready with a remote ISCSI disk ..use the format command to verify the same.



Now to deal with FC disk please follow the below procedure:

Configuring Fibre Channel Devices With COMSTAR

You can set up and configure a COMSTAR target on a SPARC system or x86 system in a FC network environment and make it accessible to the storage network. Ensure the following prerequisite step has been completed:

Configuring Fibre Channel Ports For COMSTAR

The Fibre Channel (FC) port provider can use the same HBAs that are used for the FC initiators. A given FC port can be used as an initiator or as a target, but not as both. You can also configure a dual port or quad port FC HBA so that a subset of the HBA ports is in target mode and the rest of the ports are in initiator mode.
The procedures in this section are specific to QLogic HBAs. The driver to use with HBAs in initiator mode is qlc, which is a Qlogic driver. The qlc driver works only in initiator mode, and cannot be used for target mode. The COMSTAR driver for a target QLogic 4G HBA is qlt.
Because initiator mode and target mode use different drivers, the driver you attach to an HBA port defines its function as a target or initiator. You can specify a driver for all the ports by specifying the PCI device ID of the HBA. Or, you can configure the driver on a port-by-port basis. Both methods use the update_drv command and are described in this section. For more information, see update_drv(1M).

How to Display Existing FC Port Bindings

Before making changes to the HBA ports, first check the existing port bindings.
  1. Become an administrator.
  2. Display what is currently bound to the port drivers.
    In this example, the current binding is pciex1077,2432.
    # mdb -k
    Loading modules: [ unix krtld genunix specfs ...
    > ::devbindings -q qlc
    30001617a08 pciex1077,2432, instance #0 (driver name: qlc)
    300016177e0 pciex1077,2432, instance #1 (driver name: qlc)
    > $q

How to Set All FC Ports to a Specific Mode

This procedure changes all ports on all HBAs with a specific PCI device ID to target mode. The PCI device ID number binds a driver to a port, thereby setting all the HBA ports with that PCI device ID, for example, all QLogic 4G PCI express HBAs, to target mode.
  1. Become an administrator.
  2. Remove the current binding.
    In this example, the qlc driver is actively bound to pciex1077,2432. You must remove the existing binding for qlc before you can add that binding to a new driver. Single quotation marks are required in this syntax.
    # update_drv -d -i 'pciex1077,2432' qlc
    Cannot unload module: qlc
    Will be unloaded upon reboot.
    This message does not indicate an error. The configuration files have been updated but the qlc driver remains bound to the port until the system is rebooted.
  3. Establish the new binding.
    In this example, qlt is updated. Single quotes are required in this syntax.
    # update_drv -a -i 'pciex1077,2432' qlt
    devfsadm: driver failed to attach: qlt
    Warning: Driver (qlt) successfully added to system but failed to attach
    This message does not indicate an error. The qlc driver remains bound to the port, until the system is rebooted. The qlt driver attaches when the system is rebooted.
  4. Reboot the system to attach the new driver. Then, recheck the bindings.
    # init 6
    .
    .
    .
    # mdb -k
    
    Loading modules: [ unix krtld genunix specfs dtrace ...
    > ::devbindings -q qlt
    30001615a08   pciex1077,2432, instance #0 (driver name: qlt)
    30001615e0    pciex1077,2432, instance #1 (driver name: qlt)
    > $q
  5. Verify that the target mode framework has access to the HBA ports.
    # stmfadm list-target -v
    Target: wwn.210100E08BA54E60
    Operational Status : Offline
    Provider Name : qlt(1)
    Alias : -
    Sessions : 0
    Target: wwn.210100E08BA54E60
    Operational Status : Offline
    Provider Name : qlt(0)
    Alias : -
    Sessions : 0

How to Set Selected FC Ports to Initiator or Target Mode

This procedure uses path-based bindings. It shows you how to use a specific device path to bind a port to a driver that is different from the driver to which it is currently bound.
  1. Become an administrator.
  2. Display a list of the HBA ports and their respective device paths.
    This example shows the device paths for a single HBA with two ports.
    # luxadm -e port
    /devices/pci@780/QLGC,qlc@0,1/fp@0,0:devctl CONNECTED
    /devices/pci@780/QLGC,qlc@0/fp@0,0:devctl CONNECTED
  3. Set the top port to target mode, and leave the bottom port in initiator mode.
    Remove the initial /devices portion of the path, and include everything up to /fp@0.... The path with the /devices portion removed is the path to which the system binds the qltdriver.
    Single quotation marks are required in this syntax.
    # update_drv -a -i '/pci@780/QLGC,qlc@0,1' qlt
    devfsadm: driver failed to attach: qlt
    Warning: Driver (qlt) successfully added to system but failed to attach.
    This message does not indicate an error. The qlc driver remains bound to the port until reboot. The qlt driver attaches during reboot.
  4. Reboot the system to attach the new driver. Then, recheck the bindings.
    You should see that the port changed from initiator mode (qlc) to target mode (qlt).
    # init 6
    .
    .
    .
    # mdb -k
    .
    .
    .
    > $q
  5. Verify that the target mode framework has access to the HBA ports.
    # stmfadm list-target -v

Making Logical Units Available for FC and FCoE

Simply registering a logical unit (LUN) with the STMF framework does not make it available to hosts (initiators) on the network. You must make logical units visible to initiator hosts for Fibre Channel and FCoE configurations by mapping the logical unit. To determine which method to use and how to map the logical unit, see How to Make a Logical Unit Available to All Systems. Both methods use the stmfadm command. The additional steps below are for FC and FCoE configurations.

How to Make Logical Units Available for FC and FCoE

This procedure makes the LUN available to all hosts or selected hosts for FC or FCoE configurations on a storage network. The steps are run on the host.
  1. Become an administrator.
  2. Make a LUN available to hosts.
    Obtain the global unique identification (GUID) number for the LUN.
    # sbdadm list-lu
    # stmfdm list-lu -v
    Identify the WWNs for the FC or FCoE ports of the host.
    # fcinfo hba-port
    HBA Port WWN: *210000e08b83378d*
    OS Device Name: /dev/cfg/c4
    Manufacturer: Qlogic Corp.
    Model: QLA2462
    Firmware Version: 4.0.27
    Fcode/BIOS Version: N/A
    Type: N-port
    State: online
    Supported Speeds: 1Gb 2Gb 4Gb
    Current Speed: 4Gb
    Node WWN: 210000e08b83378d
    HBA Port WWN: *210100e08ba3378d*
    OS Device Name: /dev/cfg/c5
    Manufacturer: Qlogic Corp.
    Model: QLA2462
    Firmware Version: 4.0.27
    Fcode/BIOS Version: N/A
    Type: N-port
    State: online
    Supported Speeds: 1Gb 2Gb 4Gb
    Current Speed: 4Gb
    Node WWN: 210100e08ba3378d
  3. Add a view and perform mapping.
  4. Verify that the LUN is visible on an Oracle Solaris initiator host by running the following script.
    #!/bin/ksh
    fcinfo hba-port |grep "^HBA" | awk '{print $4}' | while read 1n
    do
            fcinfo remote-port -p $1n -s >/dev/null 2>&1
    done
    All subsequent LUNs appear in the format output, because the script forces the initiator to touch all the LUNs through all the ports. If you do not see the LUNs, run the format command again. If you still do not see the LUNs, ensure that the service is enabled on the target by using the svcs stmf command. Also ensure that you added view entries for the LUN, as described in How to Make a Logical Unit Available to All Systems.
  5. Verify that the LUN is visible on other systems.
    • For a Linux initiator host, verify that the LUN is visible by running the utility provided by the HBA vendor. The utility scans for configuration changes.
    • For a Windows initiator host, verify that the logical unit is visible by selecting Control Panel -> Administrative Tools -> Computer Management -> Disk Management. Then, from the Action menu, choose Rescan Disks.

No comments:

Post a Comment