Saturday, February 4, 2012

6. To check the vendor of the SAN disk on a LINUX host


     [root@cmptrn-wc-30p ~]# cat /proc/scsi/scsi        in RHEL

5 . Find the HBA details of a Solaris machine.


 mdu-wc-2p.cable.comcast.com:/# fcinfo hba-port


####################################################

root@ sunserver:/root# fcinfo hba-port | grep WWN

root@ sunserver:/root# fcinfo hba-port

root@ sunserver:/root# prtconf -vp | grep -i wwn

root@ sunserver:/root# prtpicl -v | grep wwn

Run the following command to obtain the physical path to the HBA Ports

    root@ sunserver:/root$ luxadm -e port
    /devices/pci@400/pci@0/pci@9/SUNW,qlc@0/fp@0,0:devctl              CONNECTED
    /devices/pci@400/pci@0/pci@9/SUNW,qlc@0,1/fp@0,0:devctl            NOT CONNECTED


With the physical path obtained from the above command, we can trace the WWN numbers as follows. here I use the physical path to the one that is connected:

    root@ sunserver:/root$ luxadm -e dump_map /devices/pci@400/pci@0/pci@9/SUNW,qlc@0/fp@0,0:devctl
    Pos  Port_ID Hard_Addr Port WWN         Node WWN         Type
    0    123456  0         1111111111111111 2222222222222222 0×0  (Disk device)
    1    789123  0         1111111111111111 2222222222222222 0×0  (Disk device)
    2    453789  0         2100001b32xxxxxx 2000001b32xxxxxx 0x1f (Unknown Type,Host Bus Adapter

4 . Find the HBA details of a Linux machine.


[root@obiapp-po-1p tmp]# cat /etc/redhat-release / uname –a

[root@obiapp-po-1p tmp]# lspci | grep -i fibre

On  Red Hat Enterprise Linux 5 (5.x)
  (X is your device 1,2,3,…N)

[root@obiapp-po-1p tmp]# cat /sys/class/scsi_host/host*/device/fc_host:host*/port_name

[root@obiapp-po-1p tmp]# cat /sys/class/fc_host/host*/port_name

Sample with multiple HBA (Fibre) QLogic

[root@obiapp-po-1p tmp]# # ls /sys/class/fc_host/

host3  host4  host5  host6

[root@obiapp-po-1p tmp]# # cat /sys/class/fc_host/host[3-6]/port_name



0x2100001b32936e24
0x2101001b32b36e24
0x2100001b32932821
0x2101001b32b32821


On Red Hat Enterprise Linux 4 (AS/ES) is on /proc/scsi/qla2xxx/1 (1,2,3,..N)

Sample:
[root@obiapp-po-1p tmp]# # egrep [node|port] /proc/scsi/qlx2xxx/0

scsi-qla0-adapter-node=200000e08b1c19f2;
scsi-qla0-adapter-port=210000e08b1c19f2;

[root@obiapp-po-1p tmp]# systool -c fc_host -v

3 .Extend the FS using LVM method.


[root@obiapp-po-1p tmp]# df -h
Filesystem                                                     Size  Used Avail Use%   Mounted on
/dev/mapper/RootVolGroup00-lv_root           7.8G  5.2G  2.2G  71%         /
 /dev/mapper/RootVolGroup00-lv_var           9.7G  790M  8.5G   9%        /var
/dev/mapper/RootVolGroup00-lv_opt           20G   17G  2.3G  88%         /opt
                                          /dev/sda1              494M   18M  451M   4%    /boot
                                              tmpfs                 16G     0   16G   0%        /dev/shm
                                               tmpfs                4.0K     0  4.0K   0%       /dev/vx
      /dev/vx/dsk/clstrdg/datavol01                   511G   20G  461G   5%       /data
 [root@obiapp-po-1p tmp]#  vgdisplay
  --- Volume group ---
  VG Name               RootVolGroup00
  System ID
  Format                lvm2
====================================
====================================
  Alloc PE / Size       1344 / 42.00 GB
  Free  PE / Size       2975 / 92.97 GB 
  ===================================
   ==================================
[root@obiapp-po-1p tmp]# lvextend  –L   +20G  /dev/RootVolGroup00/lv_opt

  Extending logical volume lv_opt to 40.00 GB
  Logical volume lv_opt successfully resized

[root@obiapp-po-1p tmp]# resize2fs  /dev/RootVolGroup00/lv_opt
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/RootVolGroup00/lv_opt is mounted on /opt; on-line resizing required
Performing an on-line resize of /dev/RootVolGroup00/lv_opt to 10485760 (4k) blocks.
The filesystem on /dev/RootVolGroup00/lv_opt is now 10485760 blocks long.
[root@obiapp-po-1p tmp]# df -h
Filesystem                                                                   Size  Used Avail Use% Mounted on
/dev/mapper/RootVolGroup00-lv_root                        7.8G  5.2G  2.2G  71% /
/dev/mapper/RootVolGroup00-lv_var                          9.7G  790M  8.5G   9% /var
/dev/mapper/RootVolGroup00-lv_opt                      39G   17G   21G  44% /opt
                          /dev/sda1                                           494M   18M  451M   4% /boot
                               tmpfs                                            16G     0   16G   0% /dev/shm
                                tmpfs                                             4.0K     0  4.0K   0% /dev/vx
 /dev/vx/dsk/clstrdg/datavol01                                       511G   20G  461G   5% /data

  [root@obiapp-po-1p tmp]#

2 .Create the FS using LVM method (Through script)


[root@cmptrn-wc-31p home]# cat lvm_unix
pvcreate /dev/sdam
pvcreate /dev/sdan
pvcreate /dev/sdal
pvcreate /dev/sdai
pvcreate /dev/sdah
pvcreate /dev/sdag
pvcreate /dev/sdaf
sleep 3
#
vgextend  RootVolGroup00  /dev/sdam  /dev/sdan  /dev/sdal  /dev/sdai  /dev/sdah  /dev/sdag /dev/sdaf
sleep2
#
lvcreate -L 20G /dev/RootVolGroup00 -n lv_home_uc4
lvcreate -L 250G /dev/RootVolGroup00 -n lv_var_archive
lvcreate -L 20G /dev/RootVolGroup00 -n lv_var_cemp
lvcreate -L 150G /dev/RootVolGroup00 -n lv_var_cemp_data1
lvcreate -L 150G /dev/RootVolGroup00 -n lv_var_cemp_data2
lvcreate -L 100G /dev/RootVolGroup00 -n lv_var_cemp_logs
sleep2
#
mkfs -t ext3 /dev/RootVolGroup00/lv_home_uc4
mkfs -t ext3 /dev/RootVolGroup00/lv_var_archive
mkfs -t ext3 /dev/RootVolGroup00/lv_var_cemp
mkfs -t ext3 /dev/RootVolGroup00/lv_var_cemp_data1
mkfs -t ext3 /dev/RootVolGroup00/lv_var_cemp_data2
mkfs -t ext3 /dev/RootVolGroup00/lv_var_cemp_logs
sleep5
#
mkdir /home/uc4
mkdir /var/cemp
mkdir /var/cemp/data1
mkdir /var/cemp/data2
mkdir /var/cemp/logs
mkdir /var/archive
[root@cmptrn-wc-31p home]#  sh -x lvm_unix

1. Create the FS using LVM method.



 1.  From    fdisk –l                 identify the disk you need to add to the FS

 2.  pvcreate /dev/sdai        [pvcreate initializes PhysicalVolume for later use by the Logical Volume      Manager (LVM). Each PhysicalVolume can be a disk partition,   whole disk, meta device, or loopback file)

 3.  vgextend RootVolGroup00  /dev/sdai   -It would extend the volume group with the new disk

 4. vgdisplay RootVolGroup00     verify the volume group size again

 5. lvcreate -L  50G /dev/RootVolGroup00  -n  lv_home_cemp    Create a logical volume under the   volume group

 6. lvdisplay  /dev/RootVolGroup00/lv_home_cemp         verify the new logical  volume created

 7.  mkfs -t ext3 /dev/RootVolGroup00/lv_home_cemp     Format the FS in ext3

 8.  mount   /dev/RootVolGroup00/lv_home_cemp    /home/cemp  Mount the FS in a mountpoint

 9.  cat /etc/fstab

 9.  cp -p fstab fstab.bkp.01022012  Taking backup of fstab

10 .  vi  /etc/fstab   Edit the  file for the new Mount points

11.  echo " command " >> /etc/fstab    ( to append a command)
         Eg  : echo "/dev/RootVolGroup00/lv_home_nagios      /home/nagios    ext3    defaults        1 2" >>   /etc/fstab

12. df  –k   Verify the new FS