#>
_________ .__ .__
/ _____/ ____ | | _____ _______|__| ______
\_____ \ / _ \| | \__ \\_ __ \ |/ ___/
/ ( <_> ) |__/ __ \| | \/ |\___ \
/_______ /\____/|____(____ /__| |__/____ \
\/ \/ \/
#!/bin/sh
# Simply Guide of LUN mounting on Solaris & Linux
# Suwardi -> line.console49@gmail.com
# @ 22/4/2015
0x00. Description
Nowdays storage devices are mandatory requirement for Enterprise environment. Using internal disks are limited depends on maximum of server configuration. Storage device with connected to a server, the server enable to add/use external disks. So, we can expand the storage utilization.
0x01. Storage disk configuration and description
Storage device composed with many disks and controller. Controller is main processing of the storage. There are many differences way to configure storage, it's depend on vendor which created the storage.
In Storage product, there were two controller as main processing in active-standby mode. The other product controller functions like cluster nodes. So, it's depend on vendor which created it. Difference vendor, difference infrastructure. The controller manages disks, and all component inside the storage.
In logical view, storage configured with RAID Group. Raid Group configured with Raid level and composed from physical disks. Inside Raid Group, there was/were volume/s. Volume is logical device which accessed by server. Volume is known as LUN.
Let assume we have one storage. Configured with one Raid Group and one volume as bellow :
Raid Group name : RG01
Raid Space : 500 GB
Raid Level : Raid-5
Volume name : Vol01
Volume space: 500 GB
Storage WWN: AA:BB:CC:DD:EE:FF:00:11 <- Sample wwn
Server Solaris WWN : 00:11:22:33:44:55:66:77 <- Sample wwn
Server Redhat WWN : 12:34:56:78:90:AB:CD:EF <- Sample wwn
0x02. WWN Detection at Solaris and Redhat/Suse/Centos
There was a simply way to detect HBA and WWN both at Solaris and Linux. In solaris, we can use 'fcinfo hba-port' as bellow :
wardi@darkstar# fcinfo hba-port
HBA Port WWN: 00:11:22:33:44:55:66:77 <-wwn number
OS Device Name: /dev/cfg/c2
Manufacturer: QLogic Corp.
Model: 375-3356-02
Firmware Version: 05.03.02
FCode/BIOS Version: BIOS: 2.02; fcode: 2.01; EFI: 2.00;
Serial Number: 0402R00-1023835637
Driver Name: qlc
Driver Version: 20100301-3.00
Type: unknown
State: offline
Supported Speeds: 1Gb 2Gb 4Gb
Current Speed: not established
Node WWN: 00:11:22:33:44:55:66:77 <-wwn number
How to check WWN number at Linux Redhat/Centos/SUSE. There was long path for it in Linux as bellow :
/sys/class/scsi_host/hostN/device/fc_host/hostN/port_name
N <- Indicates hbas fiber number
The WWN number is wrote at 'port_name' file. And there were 6 host on this path as bellow :
host0
host1
host2
host3
host4
host5
So, to easily checking the WWN inside these 6 host, use the command as bellow:
wardi@darkstar# cat /sys/class/scsi_host/host*/device/fc_host/host*/node_name
0x1234567890abcdef
0x1234567890abcdef
Or, you may like a little shell programming technique using looping bellow :
wardi@darkstar# for i in 0 1 2 3 4 5;
> do cat host$i/device/fc_host/host$i/port_name;
> done
cat: host0/device/fc_host/host0/port_name: No such file or directory
cat: host1/device/fc_host/host1/port_name: No such file or directory
cat: host2/device/fc_host/host2/port_name: No such file or directory
cat: host3/device/fc_host/host3/port_name: No such file or directory
0x1234567890abcdef
0x1234567890abcdef
0x03. Configure Fabric at San Switch (San Switch Zoning)
First, you must login to San Switch box with telnet connection, port 23 with username and password. The default username and password usually admin and password is 'password'.
It will interested, ussually we are config a san switch using Java base GUI. But, let we config using command line interface, bellow commands are for Brocade San Switch :
# Switch and online port checking
switch:admin> switchshow
# Create alias
switch:admin> alicreate "solaris", "00:11:22:33:44:55:66:77"
switch:admin> alicreate "storage", "AA:BB:CC:DD:EE:FF:00:11"
switch:admin> alicreate "redhat", "12:34:56:78:90:AB:CD:EF"
Check alias :
switch:admin> alishow
# Create zone
switch:admin> zoneadd "mysolzone", "solaris;storage"
switch:admin> zoneadd "myredzone", "redhat;storage"
Check zone
switch:admin> zoneshow
# Specify config name for zone member
switch:admin> cfgadd "myconfig", "mysolzone;myredzone"
# Enable the configuration
switch:admin> cfgenable
0x04. Detecting & Configure Server WWN at Storage
After san switch configured, server's wwn should be read by storage. If the server's wwn can be read by storage, then we can constructed a storage affinity which meet server's wwn to LUN/volumes assigned for it.
First, we must scan all availability CA ports from all controller. We can identify it from WWN number using identified CA port assigned for storage to server connection which already configured at San Switch.
After server's wwn detected, then make an affinity which connected a LUN/volume/s to the server's wwn. Lun/volume can be one or more that could be assigned to a server's wwn.
0x05. Mounting LUN on Solaris
After configuration at San Switch and Storage done, it's time to configure it at server side. In Solaris, we must check that all storage path are correctly installed and must be connected. Bellow command to check the storage path connection :
wardi@darkstar# luxadm -e port
/devices/pci@5,700000/SUNW,qlc@0, /fp@0,0:devctl CONNECTED
/devices/pci@10,700000/SUNW,qlc@0,1/fp@0,0:devctl CONNECTED
After it confirmed about path the connection, then scan or refresh external disk connection with command bellow :
wardi@darkstar# devfsadm
Confirm it listed at format command :
wardi@darkstar# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t5000CCA02533EC84d0 <SUN300G cyl 46873 alt 2 hd 20 sec 625> solaris
/scsi_vhci/disk@g5000cca02533ec84
1. c0t5000CCA025479138d0
/scsi_vhci/disk@g5000cca025479138
/scsi_vhci/ssd@g60060e801040b52004f286120000001b
Disk#0 and disk#1 are 'internal disks', disk#2 is external disk from storage. It's confirm that storage LUN already detected from 'format' command.
After LUN detected at format utility, we can continued to mount it. There was a simply way using ZFS filesystem to mount a volume as bellow :
wardi@darkstar# zpool create myvol c0t60060E801040B52004F286120000001Ad0
The 'c0t60060E801040B52004F286120000001Ad0' is a logical device name for our volume that already assigned.
'myvol' is our mount point name and pool name because it's configured as zfs filesystem.
Zfs pool name and status check :
wardi@darkstar# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
myvol 500G 0G 500G 0% 1.00x ONLINE -
wardi@darkstar# ls / | grep myvol
myvol
0x06. Mounting LUN at Redhat/Centos/Suse
Mounting a storage LUN at Linux Redhat base server (Redhat/Centos/Suse) has very easy way. After the storage detected redhat's wwn, then configure affinity to meet wwn server to LUN/volume.
In the linux server side, that need a reboot to detect storage alloction. After the server reboot, then we can confirm it with 'fdisk -l' command. Output from fdisk command, the LUN/volume will appears/named as disk: /dev/sdb or /dev/sdc or /dev/sdd, etc.
After it detected, then we need to format it, for example format using ext4 filesystem :
wardi@darkstar# /sbin/mkfs.ext4 -L /myvol /dev/sdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=/myvol
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2097152 inodes, 8388352 blocks
419417 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
256 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Create /myvol directory :
wardi@darkstar# mkdir /myvol
Mounting /dev/sdb to /myvol :
wardi@darkstar# mount /dev/sdb /myvol
That all
#EOF
How To Mount Storage LUNs on Solaris and Linux
Apr 22, 2015 3:42 PM
Filed Under: cmdline, confbuild, oracle, shell, storage |1 comments
Subscribe to:
Post Comments (Atom)
1 comments:
Post a Comment