How To Manage Virtual I/O Server using Command Line

VIOS (Virtual I/O Server) is a special purpose partition that can serve I/O resources to other partitions. The type of LPAR is set at creation. The VIOS LPAR type allows for the creation of virtual server adapters, where a regular AIX/Linux LPAR does not.

VIOS works by owning a physical resource and mapping that physical resource to virtual resources. Client LPARs can connect to the physical resource via these mappings.

VIOS is not a hypervisor, nor is it required for sub-CPU virtualization. VIOS can be used to manage other partitions in some situations when a HMC is not used. This is called IVM (Integrated Virtualization Manager).

The current VIOS runs on an AIX subsystem. (VIOS functionality is available for Linux. This document only deals with the AIX based versions.) The padmin account logs in with a restricted shell. A root shell can be obtained by the oem_setup_env command.

The root shell is designed for installation of OEM applications and drivers only. It may be required for a small subset of commands. (The purpose of this document is to provide a listing of most frequent tasks and the proper VIOS commands so that access to a root shell is not required.)

The restricted shell has access to common UNIX utilities such as awk, grep, sed, and vi. The syntax and usage of these commands has not been changed in VIOS. (Use "ls /usr/ios/utils" to get a listing of available UNIX commands.)

VIOS Setup and Management:

Accept all VIOS license agreements
$ license -accept

Obtain root shell capability
$ oem_setup_env

Mirror the rootvg in VIOS to hdisk1
# extendvg rootvg hdisk1
# mirrorios hdisk1

The VIOS will reboot when finished
(Re)Start the (initial) configuration assistant
# cfgassist

Restart or Shutdown the server
# shutdown -restart
# shutdown

List the version of the VIOS system software
# ioslevel

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

List LPAR name and ID
# lslparinfo

Display firmware level of all devices on this VIOS LPAR
# lsfware -all

Display the MOTD
# motd

Change the MOTD to an appropriate message
# motd "*****    Unauthorized access is prohibited!    *****"

List all (AIX) packages installed on the system
# lssw

Display a timestamped list of all commands run on the system
# lsgcl
To display the current date and time of the VIOS

Change the current time and date to 1:02 AM March 4, 2009
# chdate -hour 1 -minute 2 -month 3 -day 4 -year 2009

Change just the timezone to AST
# chdate -timezone AST (Visible on next login)

Brief dump of the system error log
# errlog

Detailed dump of the system error log
# errlog -ls | more

Remove error log events older than 30 days
# errlog -rm 30


VIOS Networking Examples

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

View settings on ent0 device
# lsdev -dev ent0 -attr

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

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

Equivalent of no -L command
# optimizenet -list

Set up initial TCP/IP config
# mktcpip -hostname vios1 -inetaddr -interface ent3 -start -netmask -gateway

Find the default gateway and routing info on the VIOS
# netstatroutinfo

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

Show interface traffic statistics on 2 second intervals
netstat -state 2

Show verbose statistics for all interfaces
netstat -cdlistats

Show the default gateway and route table
netstat -routtable

Change the default route on en0 (fix a typo from mktcpip)
chtcpip -interface en0 –gateway -add -remove

Change the IP address on en0 to
chtcpip -interface en0 -inetaddr -netmask


User Management

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


Virtual Disk Setup and Management

Disks are presented to VIOC by creating a mapping between a physical disk or storage pool volume and the vhost adapter that is associated with the VIOC.

Best practices configuration suggests that the connecting VIOS vhost adapter and the VIOC vscsi adapter should use the same slot number. This makes the typically complex array of virtual SCSI connections in the system much easier to comprehend.

The mkvdev command is used to create a mapping between a physical disk and the vhost adapter.
Create a mapping of hdisk3 to the virtual host adapter vhost2.

# mkvdev -vdev hdisk3 -vadapter vhost2 -dev wd_c3_hd3
It is called wd_c3_hd3 for "WholeDisk_Client3_HDisk3". The intent of this naming convention is to relay the type of disk, where from, and who to.

Delete the virtual target device wd_c3_hd3
# rmvdev -vtd wd_c3_hd3

Delete the above mapping by specifying the backing device hdisk3
# rmvdev -vdev hdisk3

Virtual Optical Media

Create a 15 Gig virtual media repository on the clienthd storage pool
# mkrep -sp clienthd -size 15G

Extend the virtual repository by an additional 5 Gig to a total of 20 Gig
# chrep -size 5G

Find the size of the repository
# lsrep

Create an ISO image in repository using .iso file
# mkvopt -name powerlinux6 -file /mnt/Powerlinux-DVD.iso -ro

Create a virtual media file directly from a DVD in the physical optical drive
# mkvopt -name AIX61TL3 -dev cd0 -ro

Create a virtual DVD on vhost4 adapter
# mkvdev -fbo -vadapter vhost4 -dev virtual_dvd

The LPAR connected to vhost4 is called shiva. shiva_dvd is simply a convenient naming convention.

Load the virtual optical media into the virtual DVD for LPAR shiva
# loadopt -vtd virtual_dvd -disk powerlinux6

Unload the previously loaded virtual DVD (-release is a "force" option if the client OS has a SCSI reserve on the device.)
# unloadopt -vtd virtual_dvd -release

List virtual media in repository with usage information
# lsrep

Remove (delete) a virtual DVD image called AIX61TL3
# rmvopt -name AIX61TL3

Storage Pools

List the default storage pool
# lssp -default

List all storage pools
# lssp

List all disks in the rootvg storage pool
# lssp -detail -sp rootvg

Create a storage pool called client_boot on hdisk22
# mksp client_boot hdisk22

Make the client_boot storage pool the default storage pool
# chsp -default client_boot

Add hdisk23 to the client_boot storage pool
# chsp -add -sp client_boot hdisk23

List all the physical disks in the client_boot storage pool
# lssp -detail -sp client_boot

List all the physical disks in the default storage pool
# lssp -detail

List all the backing devices (LVs) in the default storage pool
# lsspbd

Create a client disk on adapter vhost1 from client_boot storage pool
# mkbdsp -sp client_boot 20G -bd lv_c1_boot -vadapter vhost1

Remove the mapping for the device just created, but save the backing device
# rmbdsp -vtd vtscsi0 -savebd

Assign the lv_c1_boot backing device to another vhost adapter
# mkbdsp -bd lv_c1_boot -vadapter vhost2

Completely remove the virtual target device ld_c1_boot
# rmbdsp -vtd ld_c1_boot

Remove last disk from the sp to delete the sp
# chsp -rm -sp client_boot hdisk22

Create a client disk on adapter vhost2 from rootvg storage pool
# mkbdsp -sp rootvg 1g -bd host2_hd1 -vadapter vhost2 -tn lv_host2_1