VIOS commands are easy to learn and easy to remember
Logging on as padmin
Listing 1. Logging on as padmin
The restricted shell
VIOS and AIX commands: Similarities and differences
Listing 2. Help for the lsvg command
VIOS command patterns
Listing 3. An
Listing 4. List a device with
Listing 5. List attributes of a device
Listing 6. Make a file-backed optical device
Listing 7. Change a device attribute
Common flags
Table 1. Some VIOS command flags
UNIX commands
Conclusion
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,
padmin
.
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.
Console session
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.
SSH
If your VIOS has network connectivity, you can get to a login prompt by using an SSH client such as PuTTY (see Resources).
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:
>
,>|
,<>
or>>
. But you can use the pipe (|
) and thetee
command 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 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
.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?
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.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,
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.
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 rmvdev
and rmpath
.
Here are some examples that show how VIOS commands follow these general patterns.
Commands to display or list information:
ls
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.Listing 3. An
lsmap
command examplelsmap -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
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.Listing 4. List a device with
lsdev
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:
mk
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 Resources for more information on how to make use of virtual optical devices.
Commands to change attributes and settings:
ch
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 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
.
Commands to remove or delete:
rm
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
.Common flags
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.Table 1. Some VIOS command flags
Flag | Description | Example |
---|---|---|
-lv | Logical volume | lsvg -lv rootvg |
-pv | Physical volume | lsvg -pv rootvg |
-dev Name | Device | rmdev -dev cd0 |
-attr Attribute=Value | Attribute | chdev -dev hdisk0 -attr reserve_policy=no_reserve |
-perm | Permanent change | 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.
UNIX commands
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.
Conclusion
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.
No comments:
Post a Comment