Thursday, March 3, 2016

How to mapping a disk from vio server to lpar in aix?

How to mapping a disk from vio server to lpar in aix?

Note: The below procedure is to assume that we need to add a new virutal disk to the root volume group on the lpar, for that we need to map a new disk from vio server to the lpar. 

Hence as a aix admin i need to map a new disk from vio server to the lpar like below. There are several methods to accomplish this task. The below procedure is one of them.

-------------------------------------------------------------------------------------------------------------------------------------------
Find out the slot number of the vscsi

#lspv -> To check the disk present on the lpar
hdisk0          0006a7df4403b4a6                  rootvg                      active

# lspath -F "name,status,parent,connection" -l hdisk0
            hdisk0,Enabled,vscsi0,810000000000
            hdisk0,Enabled,vscsi1,810000000000

# lscfg -l vscsi0
  vscsi0           U9111.520.0000034-V10-C50-T1  Virtual SCSI Client Adapter

# lscfg -l vscsi1
  vscsi1           U9111.520.0000034-V10-C51-T1  Virtual SCSI Client Adapter

U9111.520.0000034 -> model and serial number
V10 -> lpar id
C50 and C51 is client slot number of the vhost adapter

-------------------------------------------------------------------------------------------------------------------------------------------

Find out the VIO server associated with the lpar using HMC

# lsrsrc IBM.ManagementServer or lsrsrc IBM.MCP
------ login to the hmc with the hscroot password

The below command is used to find out the vio server name and vhost info associated with the lpar


# lshwres -r virtualio --rsubtype scsi -m U9111-520-0000034 --filter lpar_ids=10 -F "slot_num,remote_slot_num,remote_lpar_name"

Note: we can replace “-m U9111-520-0001234” with the name of your managed system

50,50,vio_server1
51,51,vio_server2

The above output shows the client slot number, server slot number, and VIO server name.
-------------------------------------------------------------------------------------------------------------------------------------------
Find out the vhost assigned for the lpar

we can find the vhost info using the slot number 


#lsdev -slots|grep -i c50
output: vhost10

So the vhost10 is associated with our target lpar.

#lsmap -vadapter vhost10
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost10          U9111.520.0000034-V2-C50                      0x0000000a

VTD                   indprodfin_rootvg
Status                Available
LUN                   0x8100000000000000
Backing device        hdisk43
Physloc               L5000000000000

the slot number is the “C50” part of the U9111.520.0000034-V2-C50. So we got the correct vhost.  (we can also confirm the 0x0000000a is the hexa decimal value of the lpar id 10.
and the pvid of the backing device is same as the pvid of the disk on the lpar.)
-------------------------------------------------------------------------------------------------------------------------------------------

Find out the free disk /unassigned disk on the vios which needs to be mapped.


$lspv -free

The above output will show the list of free disk which are available on the vio server and not mapped with any vhost.  or if we already talked with storage team and they provide the lun details then we can get the disk like below.

odmget CuAt|grep -i 4386   -> The command will list out the hdisk name.

we will take hdisk20 as a free disk for instance.

-------------------------------------------------------------------------------------------------------------------------------------------

Changing the attributes (reserve_policy and health check ) of the disk before mapping.

 As we have a dual vio set up, we need to change the reserve policy as no_reserve. Hence the disk is not hold by any of the vio server.


chdev -dev hdisk20 -attr reserve_policy=no_reserve
chdev -dev hdisk0 -attr hcheck_interval=60
-------------------------------------------------------------------------------------------------------------------------------------------

Mapping the disk to the vhost

syntax:      mkvdev -vdev <hdisk> -vadapter <vhost> -dev <VTD name>

mkvdev -vdev hdisk20 -vadapter vhost10 -dev indprodfin_rootvg

lsmap -vadapter vhost10
SVSA            Physloc                                      Client Partition ID
--------------- -------------------------------------------- ------------------
vhost10          U9111.520.0000034-V2-C50                      0x0000000a

VTD                   indprodfin_rootvg
Status                Available
LUN                   0x8100000000000000
Backing device        hdisk43
Physloc               L5000000000000


VTD                   indprodfin_rootvg1
Status                Available
LUN                   0x8200000000000000
Backing device        hdisk47
Physloc               L3000000000000

We confirm that the disk has been mapped successfully.

Now come to lpar and scan the new disk.
-------------------------------------------------------------------------------------------------------------------------------------------

Scanning the newly assigned disk on the lpar
#lspv 
hdisk0          0006a7df4403b4a6                  rootvg                      active

#cfgmgr     --> scanning the server

#lspv
hdisk0          0006a7df4403b4a6                  rootvg                      active
hdisk1              0006a7dfd9f11858                none

------------we got the newly added disk hdisk1

#lspath -l hdisk1
hdisk1,Enabled
hdisk1,Enabled
------------------------ confirmed that hdisk1 has a dual path.

# chdev -l hdisk1 -a hcheck_interval=20

#extendvg rootvg hdisk1

#lspv
hdisk0          0006a7df4403b4a6                  rootvg                      active
hdisk1              0006a7dfd9f11858               rootvg                      active