Learn more >
by Anthony English | Published November 8, 2011
IBM Power Systems™ are usually configured to use one or more VIOS. The VIOS allows you to share physical resources between logical partitions (LPARs). The VIOS is a critical component of your virtualized infrastructure, so it needs to remain stable. To protect the VIOS, there is a restricted Korn shell with a limited set of commands. Although root access is available, you can do most of the configuration and management using the restricted shell by logging in as the primary administrator, padmin.
VIOS commands use flags that almost explain themselves, making the commands quick to learn and easy to remember.
To log on to the VIOS, you can connect via a console session or use Secure Shell (SSH) to log on via the network.
To use a console session, log on to the Hardware Management Console (HMC), Integrated Virtualization Manager (IVM), or Systems Director Management Console (SDMC); select the Virtual I/O Server logical partition; choose the option to open a terminal window or console session.
If your VIOS has network connectivity, you can get to a login prompt by using an SSH client such as PuTTY (see resources on the right for more information).
Log in as the padmin user, as shown below in Listing 1.
IBM Virtual I/O Server
Last unsuccessful login: Thu Jul 7 12:06:28 GMT+10:00 2011 on /dev/vty0
Last login: Fri Sep 16 05:51:47 GMT+10:00 2011 on ssh from nim1
When you’re logged on as padmin, you have access to the restricted Korn shell. From within that shell you can run the native VIOS commands, but it’s not the same as having root access on AIX. In the restricted shell, you can’t do the following:
The VIOS’s underlying operating system is AIX. You can get to the full (unrestricted) AIX shell by logging in to the restricted shell as padmin and then entering the oem_setup_env
command. This gives you full root access to the AIX operating system, which runs the VIOS. However, use this with caution. The VIOS is critical to your environment and damage done here can have repercussions on all LPARs. You can’t log in directly to the VIOS as root.
The exit command returns you to the restricted shell as padmin.
Many of the commands in the VIOS shell are similar to AIX commands, but there are some important differences. If you know AIX—even a little—within a short time you should feel at home with the VIOS command line. When you understand the general patterns in the naming of VIOS commands and their flags, it’s a short step to mastering them.
IBM Systems Director introduces some terms that might be new to Power Systems users. The terms partition and logical partition are being replaced by the term virtual server. The VIOS is now the utility virtual server. See Related topics for more details.
Although the VIOS commands are often based on equivalent AIX commands, the flags for the VIOS CLI (when you’re logged in as padmin) usually have different flags from AIX. There are also some entirely new commands that are specific to the VIOS.
If you’re familiar with using the AIX command line, when you first start using the VIOS command line you might find the differences a little daunting. So where do you go for help?
When you’re logged into the VIOS command line as padmin, you can list the available commands by entering the help command.
Because it’s a Virtual I/O Server, many of the commands you need on the VIOS are related to devices and I/O. There are also install commands that give you the ability to update the VIOS. There are commands for managing users and security, as well as commands that help you manage volume groups, physical and logical volumes, and storage pools.
There are many standard utilities available, such as the vi editor, topas, more, crontab, ls, and others.
If you want to look at a command in more detail, you can get the command usage information by entering help followed by the command name. Listing 2 below provides an example with the lsvg command.
Usage: lsvg [‑map | ‑lv | ‑pv] VolumeGroup ... ‑field FieldName ... ‑fmt delimiter lsvg
Displays information about volume groups.
‑map Displays information about the mapping of logical and
physical volumes in the volume group.
‑field Specifies a list of fields to be displayed.
‑fmt Divides output by a user‑specified delimiter.
‑lv Displays information about logical volumes in the
‑pv Displays information about physical volumes in the
For an even more detailed description of the command and its flags, use the man pages (for example, man lsvg).
It’s not possible to go through each command in detail in this article. However, when you understand some of the common VIOS commands and flags, you have the key to learning the rest of the commands you need.
If you need to see the debug output of a command that you’re running as padmin, you can turn on debugging using export CLI_DEBUG=33. This shows you the underlying AIX commands that the padmin restricted shell is calling.
For more information about debugging the commands you are running on the VIOS CLI, see Related topics.
For many VIOS commands, you can tell what they’re for just by looking at the name. The prefix to the command is usually a clue about what it does. Commands starting with ls list or show information, such as device names, attributes, or Logical Volume Management (LVM) components. Commands to change existing devices usually start with ch. Commands for removing components generally start with rm, such as rmvdev and rmpath.
Here are some examples that show how VIOS commands follow these general patterns.
To list the mapping between physical, logical, and virtual devices, use the lsmap command. It’s common to use lsmap
-all and sift through the output one screen at a time, but you can specify a particular virtual Small Computer System Interface (vSCSI) adapter using the -vadapter flag, as you can see below in Listing 3.
lsmap ‑vadapter vhost6
SVSA Physloc Client Partition ID
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑ ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
vhost6 U9117.MMA.SN12A345B‑V1‑C110 0x0000000a
Backing device hdisk64
The -dev flag is used to name the device, and it’s the usual flag used for VIOS commands that identify a device. So, to list a device you can use lsdev followed by -dev and the device name, as shown in Listing 4.
lsdev ‑dev hdisk65
name status description
hdisk65 Available MPIO IBM 2145 FC Disk
To list all device attributes, add the -attr flag. If you specify a single attribute, its current value is shown. Listing 5 below shows how to see the reserve policy of a disk.
lsdev ‑dev hdisk65 ‑attr reserve_policy
There are many AIX LVM commands, such as lsvg to list volume groups and their characteristics and lspv to list physical volumes. However, the flags for these commands are not the same as in AIX. Use lsvg -lv VGName to list the logical volumes in a volume group. To see which physical volumes belong to a volume group, use lsvg -pv VGName.
lsvg -lv VGName
lsvg -pv VGName
Commands that add or make something generally start with mk. For example, Listing 6 shows the command to create a file-backed virtual optical device.
mkvdev ‑vadapter vhost6 ‑fbo ‑dev crm_cd0
You can use this device to load an image in ISO format using the virtual media repository. To create the repository, use mkrep. See Related topics for more information on how to make use of virtual optical devices.
If you want to change attributes, the command is chdev. Listing 7 shows how to set the queue depth on a disk.
chdev ‑dev hdisk65 ‑attr queue_depth=20
If the device is in use, you may need to change the characteristics permanently in the device’s database without actually changing the current settings. To do that, add the -perm flag. This is similar to the -P flag for the AIX chdev command.
There are a number of commands that make changes to devices. To change the device status of an MPIO-capable device, you can use chpath. To change an optical disk in the virtual media repository, for example to set it to read-only access so it can be loaded onto multiple virtual optical devices, use chvopt.
If you haven’t already guessed, you can delete or remove using the rm commands. To remove a virtual target device, use rmvdev. You can remove an MPIO path using rmpath. You can take an ISO image out of the virtual media repository using rmvopt.
Although commands are the same as AIX, or at least similar, the flags are different. VIOS commands typically use longer, more descriptive flags rather than a single character as AIX tends to do. For example, -dev is used for devices, -attr for attributes, and -fmt to specify the format of the output.
Longer flags may make for a little more typing than you usually find in AIX, but they also make the commands more obvious and easy to remember. For example, if you need a flag to indicate a logical volume, use -lv. In the same way, you can refer to physical volumes with the -pv flag. Table 1 below shows some sample flags used by the VIOS restricted shell.
lsvg -lv rootvg
lsvg -pv rootvg
rmdev -dev cd0
chdev -dev hdisk0 -attr reserve_policy=no_reserve
chdev -dev hdisk0 -attr reserve_policy=no_reserve -perm
When you know the types of flags that VIOS commands expect, you can more easily remember commands without having to look up the syntax.
There are also several standard UNIX® shell commands that you can use from within the restricted shell, such as ls, rm, cp, date, grep, tail, chmod, vi, more, tee, ftp, and several others.
As you can see, if you know your way around the AIX command line, the VIOS has a welcome mat out for you.
In this article you saw how you can learn to use the VIOS CLI. If you know AIX commands, it’s an advantage to learning similar VIOS commands. And if you’re making the transition from VIOS to AIX, your experience logged into the VIOS as padmin is a great stepping stone for the AIX CLI.
New objects in the IBM i integrated file system may not have the owner assigned as expected causing frustration. This…
See how a fictional health care company uses cloud technology to access data stored on z/OS systems.
The IBM Developer podcast is the place where developers hear all about open topics and technologies.
Back to top