![](http://4.bp.blogspot.com/-fxDiGrD1MdI/WgAq9sVkgXI/AAAAAAAAQG8/S0RqjGKIGVIisVhwz8dUZ1wXJDR_auYYgCLcBGAs/s640/virtualIOServerpowervmcommandline.jpg)
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 serveradapters, 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 padminaccount logs in with a restricted shell. A root shell can be obtained by theoem_setup_envcommand.
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, andvi. 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
$ license -accept
Obtain root shell capability
$ oem_setup_env
Mirror the rootvg in VIOS to hdisk1
# extendvg rootvg hdisk1
# mirrorios 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
chdate
chdate
Change the current time and date to 1:02 AM March 4, 2009
# chdate -hour 1 -minute 2 -month 3 -day 4 -year 2009
# chdate -hour 1 -minute 2 -month 3 -day 4 -year 2009
Change just thetimezone to AST
# chdate -timezone AST (Visible on next login)
# chdate -timezone AST (Visible on next login)
Brief dump of the system error log
# errlog
# errlog
Detailed dump of the system error log
# errlog -ls | more
# errlog -ls | more
Remove error log events older than 30 days
# errlog -rm 30
# errlog -rm 30
VIOS Networking Examples
Enable jumbo frames on the ent0 device
# chdev -dev ent0 -attr jumbo_frames=yes
# chdev -dev ent0 -attr jumbo_frames=yes
View settings on ent0 device
# lsdev -dev ent0 -attr
# lsdev -dev ent0 -attr
List TCP and UDP sockets listening and in use
# lstcpip -sockets -family inet
# lstcpip -sockets -family inet
List all (virtual and physical) ethernet adapters in the VIOS
# lstcpip -adapters
# lstcpip -adapters
Equivalent of no -L command
# optimizenet -list
# optimizenet -list
Set up initial TCP/IP config
# mktcpip -hostname vios1 -inetaddr 172.22.2.10 -interface ent3 -start -netmask 255.255.252.0 -gateway 172.22.2.1
# mktcpip -hostname vios1 -inetaddr 172.22.2.10 -interface ent3 -start -netmask 255.255.252.0 -gateway 172.22.2.1
Find the default gateway and routing info on the VIOS
# netstat–routinfo
# netstat–routinfo
List open (TCP) ports on the VIOS IP stack
lstcpip -sockets | grep LISTEN
lstcpip -sockets | grep LISTEN
Show interface traffic statistics on 2 second intervals
netstat -state 2
netstat -state 2
Show verbose statistics for all interfaces
netstat -cdlistats
netstat -cdlistats
Show the default gateway and route table
netstat -routtable
netstat -routtable
Change the default route on en0 (fix a typo from mktcpip)
chtcpip -interface en0 –gateway -add 172.22.10.1 -remove 192.168.0.1
chtcpip -interface en0 –gateway -add 172.22.10.1 -remove 192.168.0.1
Change the IP address on en0 to 172.22.10.10
chtcpip -interface en0 -inetaddr 172.22.10.10 -netmask 255.255.255.0
chtcpip -interface en0 -inetaddr 172.22.10.10 -netmask 255.255.255.0
User Management
padminis 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
# lsuserpadmin
# lsuserpadmin
List all users on the system
# lsuser
# lsuser
Change the password for the current user
# passwd
# 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 typicallycomplex array of virtual SCSI connections in the system much easier to comprehend.
The mkvdevcommand is used to create a mapping between a physical disk and the vhostadapter.
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
# rmvdev -vtd wd_c3_hd3
Delete the above mapping by specifying the backing device hdisk3
# rmvdev -vdev hdisk3
# rmvdev -vdev hdisk3
Virtual Optical Media
Create a 15 Gig virtual mediarepository on the clienthd storage pool
# mkrep -spclienthd -size 15G
# mkrep -spclienthd -size 15G
Extend the virtual repository by an additional 5 Gig to a total of 20 Gig
# chrep -size 5G
# chrep -size 5G
Find the size of the repository
# lsrep
# lsrep
Create an ISO image in repositoryusing .iso file
# mkvopt -name powerlinux6 -file /mnt/Powerlinux-DVD.iso -ro
# 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
# mkvopt -name AIX61TL3 -dev cd0 -ro
Create a virtual DVD on vhost4 adapter
# mkvdev -fbo -vadapter vhost4 -dev virtual_dvd
# 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
# 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
# unloadopt -vtd virtual_dvd -release
List virtual media in repositorywith usage information
# lsrep
# lsrep
Remove (delete) a virtual DVD image called AIX61TL3
# rmvopt -name AIX61TL3
# rmvopt -name AIX61TL3
Storage Pools
List the default storage pool
# lssp -default
# lssp -default
List all storage pools
# lssp
# lssp
List all disks in the rootvg storage pool
# lssp -detail -sprootvg
# lssp -detail -sprootvg
Create a storage pool called client_boot on hdisk22
# mksp client_boot hdisk22
# mksp client_boot hdisk22
Make the client_boot storage pool the default storage pool
# chsp -default client_boot
# chsp -default client_boot
Add hdisk23 to the client_boot storage pool
# chsp -add -sp client_boot hdisk23
# chsp -add -sp client_boot hdisk23
List all the physical disks in the client_boot storage pool
# lssp -detail -sp client_boot
# lssp -detail -sp client_boot
List all the physical disks in the default storage pool
# lssp -detail
# lssp -detail
List all the backing devices (LVs) in the default storage pool
# lssp–bd
# lssp–bd
Create a client disk on adapter vhost1 from client_boot storage pool
# mkbdsp -sp client_boot 20G -bd lv_c1_boot -vadapter vhost1
# 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
# rmbdsp -vtd vtscsi0 -savebd
Assign the lv_c1_boot backing device to another vhost adapter
# mkbdsp -bd lv_c1_boot -vadapter vhost2
# mkbdsp -bd lv_c1_boot -vadapter vhost2
Completely remove the virtual target device ld_c1_boot
# rmbdsp -vtd ld_c1_boot
# rmbdsp -vtd ld_c1_boot
Remove last disk from the sp to delete the sp
# chsp -rm -sp client_boot hdisk22
# chsp -rm -sp client_boot hdisk22
Create a client disk on adapter vhost2 fromrootvg storage pool
# mkbdsp -sp rootvg 1g -bd host2_hd1 -vadapter vhost2 -tn lv_host2_1
# mkbdsp -sp rootvg 1g -bd host2_hd1 -vadapter vhost2 -tn lv_host2_1