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.

Tuesday, 19 November 2013

VIOS Commands



Basic VIOS commands (user management)

Note: padmin is the only user for most configurations. It is possible to configure additional users such as operational users for monitoring purposes.                                                                                                                       

List attributes of the padmin user
$ lsuser padmin 

List all users on the system
$ lsuser 

Change the password for the current user
$ passwd 

 IOS Version (List the verion of the VIOS oslevel)
$ ioslevel 

Accept all VIOS license agreements
$ license –accept 

List the boot devices for this lpar
$ bootlist -mode normal –ls 

List LPAR name and ID
$ lslparinfo 

Display the MOTD
$ motd 

Restricted shell to root shell
$ oem_setup_env 

Determine the underlying (AIX) oslevel.
$ oem_plateform_level 

To display the current date & time of the VIO server
$ chdate 



VIOS Backup                                             

This creates a nim_resources.tar file which contains the mksysb and spot.
$ backupios  -file "/the directory name"                      

This creates only the mksysb file.
$ backupios  -file "/the directory name" - mksysb                        

e.g ( Here is an example of my vios1 mksysb)

$ backupios -file /home/padmin/viobackup/vios1.mksysb -mksysb 
/home/padmin/viobackup/vios1.mksysb  doesn't exist.
Creating /home/padmin/viobackup/vios1.mksysb
Creating information file for volume group mksysbvg..
Creating list of files to back up.
Backing up 6 files
6 of 6 files (100%)
0512-038 savevg: Backup Completed Successfully.
Backup in progress.  This command can take a considerable amount of time
to complete, please be patient...
Creating information file (/image.data) for rootvg..
Creating list of files to back up......
Backing up 88837 files..............................
461 of 88837 files (0%)..............................
1010 of 88837 files (1%)..............................
1220 of 88837 files (1%)..............................
6651 of 88837 files (7%)..............................
29598 of 88837 files (33%)..............................
51915 of 88837 files (58%)..............................
81689 of 88837 files (91%).......
88837 of 88837 files (100%)
0512-038 savevg: Backup Completed Successfully.
$

 Mirror rootvg in VIOS

Check, does rootvg already mirrored
$ lsvg -lv rootvg 

Check no. of disk in rootvg
$ lsvg –pv rootvg 

Check free disk for mirror (In my case hdisk1 available)
$ lspv –free 

Lets add the hdisk1 in rootvg
$ extendvg rootvg hdisk1 

Lets start mirroring, must use –defer otherwise, vios will reboot as soon as mirroring finish.
Check ioslevel of your VIOS before start mirroring.
$ mirrorios –defer hdisk1 
Note: You might required to use –f (force) for mirror.

Check bootlist after mirror
$ bootlist -mode normal –ls 
hdisk0 blv=hd5
hdisk1 blv=hd5
$

Note: If mirrored rootvg disk are not specified in bootlist run command below$ bootlist -mode normal hdisk0 hdisk1 
  
Devices

This command is similar to cfgmgr (to scan/discover for new devices in vios)
$ cfgdev 

List all physical volumes
$ lspv 

List all unmapped disks
$ lspv –free 

List all devies (virtual & phsyical) by their slot addresses
$ lsdev -slots 

List all adapters
$ lsdev -type adapter 

List all virtual adapters
$ lsdev -virtual -type adapter 

A detailed description of hdisk5 (Vital Product Data)
$ lsdev -dev hdisk5 -vpd 

List the parent device of hdisk0
$ lsdev -dev hdisk0 -parent 

List no. of physical volumes(hdisks) in rootvg
$ lsvg -pv rootvg 

Check lv in rootvg
$ lsvg –lv rootvg 

List the size of hdisk0
$ lspv -size hdisk0 

Create Volume group (datavg) in VIOS
$ mkvg –f –vg datavg hdisk5 

Create LVs e.g (lpar1lv) in datavg in VIOS (This lv can be assigned to an lpar as an disk).
$ mklv –lv lpar1lv datavg 10G 

List all (vtd) virtual disks mapping devices(created with mkvdev command)
$ lsdev -virtual -type disk 

List all devices (physical and virtual) by their slot address
$ lsdev –slots 

Find the WWN of the fcs0 HBA (Host Bus Adapter)
$ lsdev -dev fcs0 -vpd | grep Network 






Assign a Disk / LV to a Virtual SCSI Host Adapter (vhostX)

$ lspv 

List unmapped disk
$ lspv –free 

List virtual device mapping
$lsmap –all 

To map hdisk22 to vhost1, just type
$ mkvdev -vdev hdisk22 -vadapter vhost1 
  vtscsi1 available

But you can specify your own name for the mapping device by making use of the -- >dev option
$ mkvdev -vdev hdisk22 -vadapter vhost1 –dev lpar1_22 
  lpar1_22 available

Verify
$ lsmap –vadapter vhost1 

If you use LVs rather than whole disks or LUNs the same rules apply:
$ mkvdev -vdev lpar1_lv03 -vadapter vhost1 
  vtscsi1 available

Custom LV mapping device
$ mkvdev -vdev lpar1_lv03 -vadapter vhost1 -dev lpar1_lv03 
  lpar1_lv03 available

Verify
$ lsmap –vadapter vhost1 

List only the virtual target devices attached to the vhost1 adapter
$ lsmap –vadapter vhost1 –field vtd 

Unassign a Disk/LV from a Virtual SCSI Host Adapter (Remove mapping)

List mapping on vhost1
$ lsmap –vadapter vhost1 

Remove specific mapping
$ rmvdev –vtd vtscsi

Verify
$ lsmap –vadapter vhost1 

Check the reserve-policy on hdisk

You might required to change the reserve-policy on a disk, if same disk required from dual VIOS.
$ lspv 
$ lspv -free 

List attributes of hdisk22
$ lsdev  -dev hdisk22 -attr 

Change Reserve policy from no_resove to single_path or vice versa
$ chdev -dev hdisk22 -attr reserve_policy=no_reserve 
$ chdev -dev hdisk22 -attr reserve policy=single_path 

Verify
$ lsdev  -dev hdisk22 -attr 

List the parent device of hdisk0
$ lsdev -dev hdisk0 -parent 

List all the child devices of scsi1
$ lsdev -dev scsi1 -child 
  
Network

List Shared Ethernet Adapters
$ lsmap -all –net

$ lsdev |grep ent 

$ lsdev -dev ent0 -vpd 

Create a Shared Ethernet Adapter

To create a Shared Ethernet Adapter (SEA) you need:

 
1 Physical Ethernet Adapter     +     1 Virtual Ethernet Adapter    =    1 Shared Ethernet Adapter
   ent0/ent1                 ent2                  ent3

Syntax
$ mkvdev -sea -vadapter -default -defaultid

To make SEA ent3 on physical ent0 and virtual ent2
$ mkvdev -sea ent0 -vadapter ent2 -default ent2 -defaultid 199 

Shared Ethernet Adapter Failover:
$ mkvdev -sea -vadapter -default -defaultid -attr ha_mode=auto ctl_chan=

Example: To create a Shared Ethernet Adapter(SEA) on top of an virtual adapter ent11 using VLAN 20, the physical adapter ent2 as backend, and the virtual adapter ent13 for the control channel type:

$ mkvdev -sea ent2 -vadapter ent11 -default ent11 -defaultid 20 -attr ha_mode=auto ctl_chan=ent13


Check attributes of SEA in more organize format or check status of virutal ethernet adapters
$ lsmap -net –all 

Check the attributes of SEA. Also tells which is physical , virtual and sea adapter.
$ lsdev -dev ent4 -attr 

Find virtual adapters associated with SEA ent4.
$ lsdev -dev ent4 -attr virt_adapters 

Find physical (backing) adapter for SEA ent4.
$ lsdev -dev ent4 -attr real_adapter 

List all (virtual and physical) ethernet adapters in the VIOS
$ lstcpip -adapters 

To check the ip address assinged to VIOS
$ lstcpip –interfaces 
Setup  IP Address

To configure an local IP 192.168.3.30 address to en3 use
$ mktcpip  -hostname VIOS1 \
            -inetaddr 192.168.3.30 \
            -interface en3 -start \
            -netmask 255.255.255.0 \
            -gateway 192.168.3.1 
$

Change the default gateway address 192.168.9.1 with 192.168.1.1
$ chtcpip –interface en0 \
           -gateway –add 192.168.1.1 –remove 192.168.9.1 

Change the IP address on en0 from 192.168.3.30 to 192.168.1.30

$ chtcpip –interface en0 \
           -inetaddr 192.168.1.30 –netmask 255.255.255.0 

You can also use root shell to change the IP
$ oem_setup_env 

# smitty mktcpip                      

Remove an IP Address
$ rmtcpip -interface en3 



Find Active VIOS

To check which VIO is active for SEA (where ent3 is SEA)
entstat -all sea_adapter |grep -i active
$ entstat -all ent3 |grep -i active 

Check Network Link Status
To check network link (where ent3 is SEA)
entstat -all sea_adapter |grep -i link
$ entstat -all ent3 |grep -i link 


Default gateway and routing table
$ netstat –routtable 


To check network duplexing

entstat -all sea_adapter |grep -i media
$  entstat -all ent4 |grep -i media 

List the port speed of the (physical) ethernet adapter eth0
$ lsdev -dev ent0 -attr media_speed 

List all the possible settings for media speed on ent0
$ lsdev -dev ent0 -range media_speed 

Set the media speed to auto negotiate on ent0
$ chdev -dev ent0 -attr media speed=Auto_Negotiation 

Set the media speed to auto negotiate on ent0 on next boot
$ chdev -dev ent0 -attr media speed=Auto_Negotiation –perm 

Enable jumbo frames on the ent0 device
$ chdev -dev ent0 -attr jumbo frames=yes 

View settings on ent0 device
$ lsdev -dev ent0 –attr 



List open (TCP) ports on the VIOS IP stack
$ lstcpip -sockets | grep LISTEN 

List TCP and UDP sockets listening and in use
$ lstcpip -sockets -family inet 

Tell which vios is primary
$ entstat -all ent4 |grep -i PRIMARY 


Tells which vios is backup
$  entstat -all ent4 |grep  -i BACKUP 

No comments:

Post a Comment