Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday, 18 April 2014

Disk replacement on VIO server



Replace failed disk in VIOS
This article describes two common scenarios for replacing failing local disk in VIOS.
Scenario 1:   Failed disk in VIO server which is used by VIO client(s)

The failing disk contains LVs used for rootvg of VIO clients. The rootvg is
 mirrored to another disk presented by a second VIO server. This scenario is illustrated below:
Procedure to replace failing disk on VIO server:
On VIOS: as padmin user:
Record information which will be needed for later operations and recreation of devices:
$ lsdev -virtual
To get volume group name in which failed disk participate:
$ lspv
To get list of  logical volumes on disk:
$ lspv -lv
To get info about logical volumes, e.g. size (number of LPs):
$ lsvg -lv
$ lsvg
To get info about LVs, VTD names, vhost numbers and virtual clients:
$ lsmap –all

On client(s): Identify affected disk(s)(LVs on bad disk on VIOS):
# lscfg -vl  (for all virtual SCSI disks)
hdisk1           U9117.MMA.999999-V2-C12-T1-L8200000000000000  Virtual SCSI Disk Drive
Take note of the following:
V# – LPAR ID (this should be the LPAR ID of the affected VIOS)
C# – slot number
L# – LUN ID
The affected disk may be listed as removed or missing depending on the failure.
# lsvg -p rootvg
Remove the bad disk from the mirror:
# unmirrorvg rootvg
# reducevg rootvg
# rmdev -dl hdisk#
On VIOS:
Remove all VTDs and LVs that reside on the failed disk:
$ rmvdev -vtd -rmlv
or
$ rmdev -dev
$ rmdev -dev
Check if all logical volumes are removed from bad disk:
$ lspv -lv
Remove the disk from the respective volume group:
$ reducevg
Note: If the volume group 
consists of only one disk then the whole VG will need to be removed from ODM. In that case use the following commands:
$ deactivatevg
$ exportvg
Replace the failed disk:
$ diagmenu
–> select “Task Selection”
–> select “
Hot Plug Task”
–> select “SCSI and SCSI RAID 
Hot Plug Manager
–> Replace/Remove a Device Attached to an 
SCSI Hot Swap Enclosure
Configure the new disk:
$ cfgdev
Add the new disk to the volume group or recreate the VG in case it was removed:
$ extendvg
or
$ mkvg -vg  
Recreate the LVs with the same names and size which we got in the beginning.
$ mklv -lv
Recreate the VTDs:
$ mkvdev -vdev -vadapter -dev
On client(s):
Discover new disk(s) and rebuid mirror:
# cfgmgr
# extendvg rootvg
# mirrorvg rootvg
Build 
boot image on both mirrored disks (just in case):
# bosboot -ad /dev/
# bosboot -ad /dev/
Set bootlist:
# bootlist -m normal <
list names of both hdisks>
# bootlist -m normal -o
Scenario 2:  Bad disk in rootvg of VIO server
Usually rootvg utilize some 
kind of disk protection. Most often rootvg consists of disks which are LVM mirrored. To replace a mirrored hdisk in rootvg of VIO server you can use VIO commands or root AIX commands (to become root, use oem_setup_env command). In this example we will use VIO commands since this is the recommended way of managing VIOS.
Break the mirror:
$ unmirrorios  , where is the bad disk
Check if any LV remained on the bad disk:
$ lspv -lv
If there are any (e.g. lg_dumplv – dump device) migrate them to the other disk or remove them (dump device can be recreated later):
$ migratepv -lv
or
$ rmlv -f
Take out failed disk from rootvg:
$ reducevg rootvg
Use ”Hot Plug” procedure to replace the failed disk:
$ diagmenu
–> select “Task Selection”
–> select “Hot Plug Task”
–> select “SCSI and SCSI RAID Hot Plug Manager”
–> Replace/Remove a Device Attached to an SCSI Hot Swap 
Enclosure
Configure the new disk:
$ cfgdev
Verify that the new disk came back with the same number as the previous one:
$ lspv
$ extendvg rootvg
$ mirrorios -defer  (Note that if you do not use -defer option, your VIO server will be rebooted after mirroring completes)
Check bootlist to ensure that both disks are included as boot devices:
$ bootlist -mode normal -ls
hdisk0 blv=hd5
hdisk1 blv=hd5
Use the command below to include both disks if they do not show up in the bootlist:
$ bootlist -mode normal hdisk0 hdisk1


[How To] Convert a small VG to Big VG or Scalable VG

1. Types of Volume Groups
VG typeMaximum PVsMaximum LVsMaximum PPs per VGMaximum PP size
Normal VG3225632,512 (1016 * 32)1 GB
Big VG128512130,048 (1016 * 128)1 GB
Scalable VG102440962,097,152128 GB
2.  How to determine the type of volume Group
You can use the readvgda command to check a VG’s type:
# readvgda hdisk30 | grep type
.....    readvgda_type: smallvg
3.  Convert to Big VG or Scalable
To convert a standard VG to big VG format every physical volume in the volume group needs at least one free physical partition. The volume group oraclevg contains 13 physical volumes with no free partitons left:
lsvg_p
So the first physical partition of hdisk31, hdisk32, hdisk33.. till hdisk42 and hdisk44 have to be moved to hdisk30. To find the affected logical volumes we check disk by disk for the logical volume residing on the first PP:
# lspv -l hdisk31
hdisk31:
LV NAME     LPs PPs   DISTRIBUTION              MOUNT POINT
orp32101lv  799 799   160..160..159..160..160   /orp321am01

# lspv -l hdisk32
hdisk32:
LV NAME     LPs PPs   DISTRIBUTION              MOUNT POINT
orp32101lv  799 799   160..160..159..160..160   /orp321am01

.....so on till last physical disk......
Affected LV is orp32101lv . To find the logical partitions to be migrated we look for physical partiton ’0001′ on each disk..
# lslv -m orp32101lv| grep -w 0001|egrep '(hdisk31|32|33|34|35|36|37|38|39|40|41|42|44)' 
0001 0161 hdisk31 
0320 0001 hdisk31 
1119 0001 hdisk32 
1918 0001 hdisk33 
2717 0001 hdisk34 
3516 0001 hdisk35 
4315 0001 hdisk36 
5114 0001 hdisk37 
5913 0001 hdisk38 
6712 0001 hdisk39 
7511 0001 hdisk40 
8310 0001 hdisk41 
9109 0001 hdisk42 
0001 0161 hdisk44 
0320 0001 hdisk44
start the migration using migratelp:
# migratelp orp32101lv/0320 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 320 of logical volume
 orp32101lv migrated to physical partition 160 of hdisk30.
# migratelp orp32101lv/1119 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 1119 of logical volume
 orp32101lv migrated to physical partition 159 of hdisk30.
# migratelp orp32101lv/1918 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 1918 of logical volume
 orp32101lv migrated to physical partition 158 of hdisk30.
# migratelp orp32101lv/2717 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 2717 of logical volume
 orp32101lv migrated to physical partition 157 of hdisk30.
# migratelp orp32101lv/3516 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 3516 of logical volume
 orp32101lv migrated to physical partition 156 of hdisk30.
# migratelp orp32101lv/4315 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 4315 of logical volume
 orp32101lv migrated to physical partition 155 of hdisk30.
# migratelp orp32101lv/5114 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 5114 of logical volume
 orp32101lv migrated to physical partition 154 of hdisk30.
# migratelp orp32101lv/5913 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 5913 of logical volume
 orp32101lv migrated to physical partition 153 of hdisk30.
# migratelp orp32101lv/6712 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 6712 of logical volume
 orp32101lv migrated to physical partition 152 of hdisk30.
# migratelp orp32101lv/7511 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 7511 of logical volume
 orp32101lv migrated to physical partition 151 of hdisk30.
# migratelp orp32101lv/ 8310 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 8310 of logical volume
 orp32101lv migrated to physical partition 150 of hdisk30.
# migratelp orp32101lv/ 9109 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 9109 of logical volume
 orp32101lv migrated to physical partition 149 of hdisk30.
# migratelp orp32102lv/320 hdisk30
 0516-1291 migratelp: Mirror copy 1 of logical partition 320 of logical volume
 orp32102lv migrated to physical partition 148 of hdisk30.
Checking…..
# lsvg -p oraclevg
 oraclevg:
 PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
 hdisk30 active   799        438     131..00..00..147..160
 hdisk31 active   799         1      01..00..00..00..00
 hdisk32 active   799         1      01..00..00..00..00
 hdisk33 active   799         1      01..00..00..00..00
 hdisk34 active   799         1      01..00..00..00..00
 hdisk35 active   799         1      01..00..00..00..00
 hdisk36 active   799         1      01..00..00..00..00
 hdisk37 active   799         1      01..00..00..00..00
 hdisk38 active   799         1      01..00..00..00..00
 hdisk39 active   799         1      01..00..00..00..00
 hdisk40 active   799         1      01..00..00..00..00
 hdisk41 active   799         1      01..00..00..00..00
 hdisk42 active   799         1      01..00..00..00..00
 hdisk43 active   799         12     00..12..00..00..00
 hdisk44 active   799         1      01..00..00..00..00
 hdisk45 active   799         1      00..01..00..00..00
Finally we are ready to migrate the volume group to big VG format.
# chvg -B oraclevg
0516-1216 chvg: Physical partitions are being migrated for volume group descriptor area expansion. Please wait.

 0516-1164 chvg: Volume group oraclevg changed. With given characteristics oraclevg can include up to 128 physical volumes with 1016 physical partitions each.
To be able to integrate physical volumes with more than 1016 partitions we need to increase the limit of the number of physical partitions per physical volume:
# chvg -t 2 oraclevg
 0516-1164 chvg: Volume group oraclevg changed. With given characteristics oraclevg  can include up to 64 physical volumes with 2032 physical partitions each.
As we see we have one physical partiton less per disk. This is due to a larger VGDA with big VGs:
# lsvg -p oraclevg
oraclevg:
PV_NAME PV STATE TOTAL PPs FREE PPs   FREE DISTRIBUTION
hdisk30 active     798       437      130..00..00..147..160
hdisk31 active     798       0        00..00..00..00..00
hdisk32 active     798       0        00..00..00..00..00
hdisk33 active     798       0        00..00..00..00..00
hdisk34 active     798       0        00..00..00..00..00
hdisk35 active     798       0        00..00..00..00..00
.................

[How-To] Add, Remove CD/DVD ROM from LPAR Dynamically


Safe way to Move/Remove the CD/DVD ROM from LPAR using DLPAR Operation:
On the LPAR find out where the CD/DVD-ROM is assigned:
# lsdev -Cc cdrom
cd0   Available  03-08-00   SATA DVD-ROM Drive
# lsdev -Cl cd0 -F parent
sata0
# lsdev -Cl sata0 -F parent
sissas0
# lsslot -c slot
# Slot Description Device(s)
HEA 17 Logical I/O Slot lhea1 ent0
U789D.001.DQD52DG-P1-T1   Logical I/O Slot pci4 usbhc2 usbhc3
U789D.001.DQD52DG-P1-T3   Logical I/O Slot pci3 sissas0
U9117.MMA.6534BE4-V4-C0   Virtual I/O Slot vsa0
U9117.MMA.6534BE4-V4-C4   Virtual I/O Slot vscsi0
U9117.MMA.6534BE4-V4-C8   Virtual I/O Slot vscsi1
U9117.MMA.6534BE4-V4-C22  Virtual I/O Slot vscsi3
U9117.MMA.6534BE4-V4-C24  Virtual I/O Slot vscsi4
# lsdev -Cc cdrom -F "name physloc"
cd0 U789D.001.DQD52DG-P4-D1
Remove the slot from this host:
# rmdev -dl pci3 -R
cd0 deleted
sissas0 deleted
sata0 deleted
pci3 deleted
Then from HMC — go to –> Dynamically Logical Partitioning –> Physical Adapters –> Remove the controller and then assign to another partition.



[How-To] Create an LPP source from CD/DVD


What is lpp_source

An lpp_source is a directory similar to AIX install CDs. It contains AIX Licensed Program Products (LLPs) in Backup File Format (BFF) format and RPM Package Manager (RPM) filesets that you can install.

How to Create lpp_source

  • As root, On NIM server create a directory to hold the lpp_source.
cd /export/nim/lpp_source
mkdir aix_71_tl03
  • On NIM server, Start up nim with smitty nim The “Network Installation management” menu will appear.
    • select “Perform NIM Administration Tasks” as shown below:
   
  • Select Manage Resources
  
  • Select Define a Resource
  • Choose lpp_source
  • Fill out the fields below:
    • Resource Name:  The unique name of the resource you are adding to the NIM environment. The name you supply identifies the resource in the NIM environment
    • Server of Resource: Lists the NIM name of the machine that serves this resource.
    • Location of Resource: The path name on the server where the resource resides.
    • NFS Client Security Method(optional): Specify that the mount commanduses Data Encryption Standard (DES)  for NFS transaction
    • Source of Install Image: Specifies which device or NIM resource is to be used when creating the resource.
  • Hit Enter, The command will process, and eventually come back with “OK”.
  • On the command line, you can optionally check to see that the lpp source was created by:
lsnim -l aix_71_tl03
aix_71_tl03:
 class = resources
 type = lpp_source
 arch = power
 Rstate = ready for use
 prev_state = verification is being performed
 location = /export/nim/lpp_source/aix_71_tl03
 simages = yes
 alloc_count = 0
 server = master