Get to know the VIOS CLI
VIOS commands are easy to learn and easy to remember
Why the VIOS is critical
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,
VIOS commands use flags that almost explain themselves, making the commands quick to learn and easy to remember.
Logging on as padmin
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 Related topics).
Log in as the
padmin user, as shown below in Listing 1.
Listing 1. Logging on as padmin
IBM Virtual I/O Server login: padmin padmin's Password: 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 $
The restricted shell
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:
- Change directory.
- Set variables for SHELL, ENV, or PATH.
- Run a command with a path name that contains a forward slash (/).
- Redirect command output using:
>>. But you can use the pipe (
|) and the
teecommand to capture command output.
Access to the unrestricted AIX shell
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
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
VIOS and AIX commands: Similarities and differences
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.
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
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
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
Listing 2. Help for the lsvg command
help lsvg 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 volume group. -pv Displays information about physical volumes in the volume group.
For an even more detailed description of the command and its flags, use the man pages (for example,
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.
VIOS command patterns
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
Here are some examples that show how VIOS commands follow these general patterns.
Commands to display or list information:
To list the mapping between physical, logical, and virtual devices, use the
lsmap command. It's common to use
-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.
Listing 3. An
lsmap command example
lsmap -vadapter vhost6 SVSA Physloc Client Partition ID --------------- -------------------------------------------- ------------------ vhost6 U9117.MMA.SN12A345B-V1-C110 0x0000000a VTD sapcrm_boot_a Status Available LUN 0x8100000000000000 Backing device hdisk64 Physloc U789D.001.DQD72TP-P1-C1-T1-W500507680110239F-L3E000000000000 Mirrored false
-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.
Listing 4. List a device with
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.
Listing 5. List attributes of a device
lsdev -dev hdisk65 -attr reserve_policy value no_reserve
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.
Commands to make a new device:
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.
Listing 6. Make a file-backed optical device
mkvdev -vadapter vhost6 -fbo -dev crm_cd0 crm_cd0 Available
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.
Commands to change attributes and settings:
If you want to change attributes, the command is
chdev. Listing 7 shows how to set the queue depth on a disk.
Listing 7. Change a device attribute
chdev -dev hdisk65 -attr queue_depth=20 hdisk65 changed
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
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
Commands to remove or delete:
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
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
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.
Table 1. Some VIOS command flags
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
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.
See Capturing Debug Output of padmin CLI to learn how to gather the debug output of a failing
- New terms for Power Systems users in IBM Systems Director lists and defines terms used in IBM Systems Director and maps them to any similar terms that exist in a Power Systems environment.
- The Virtual I/O Server documentation has a wealth of information on managing the VIOS. A good reference guide is the categorical list of commands, which groups the VIOS commands by category (device commands, installation, logical volume, and so on).
- This article Media Release shows how to use the virtual media repository to keep software and operating system backups handy without using physical media.
- Follow me on Twitter and keep up with my blog updates.
- Download Putty, a free Telnet/SSH client.
- Evaluate IBM products in the way that suits you best: Download a product trial, try a product online, use a product in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement Service Oriented Architecture efficiently.
- Try out IBM software for free. Download a trial version, log into an online trial, work with a product in a sandbox environment, or access it through the cloud. Choose from over 100 IBM product trials.