Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday, 18 October 2013

VIO Server Howto

VIO Server Howto


Contents

  1. Run IOS commands as root
  2. What is the AIX command behind an ioscli command?

IOS - Information and Maintenance

  1. List all ioscli commands
  2. IOS Version
  3. Apply IOS Fixes
  4. Reboot the VIO Server

Virtual Devices: Storage

  1. List unmapped disks
  2. List all Disk Mappings
  3. Create a Virtual SCSI Host Adapter
  4. Remove a Virtual SCSI Host Adapter
  5. Assign a Disk/LV to a Virtual SCSI Host Adapter
  6. Unassign a Disk/LV from a Virtual SCSI Host Adapter

Virtual Devices: Fibre Channel

  1. Create a Virtual Fibre Channel Adapter
  2. List Virtual Fibre Channels
  3. List NPIV Capable Ports
  4. Assign a Physical FC Adapter to a Virtual Fibre Channel Adapter
  5. Unassign a Physical FC Adapter from a Virtual Fibre Channel Adapter

Virtual Devices: Network

  1. List Shared Ethernet Adapters
  2. Create a Shared Ethernet Adapter
  3. List Links on Physical Ethernet Adapters
  4. Set a local IP Address
  5. Remove a local IP Address

1. Run IOS commands as root

According to IBM you should never work as root on VIO servers. However, if you login as user padmin and type
 oem_setup_env
you get the root credentials (without even been asked for a password).
By default the ioscli commands are not available for the root user. All ioscli commands are in fact calls of /usr/ios/cli/ioscli with the command as argument. You see this if you list the aliases of the padmin user.
Knowing this you can use all ioscli commands as user root by appending /usr/ios/cli/ioscli. Instead of »lsmap -all« you would type
 root@vios# /usr/ios/cli/ioscli lsmap -all
If you set an alias
 alias i=/usr/ios/cli/ioscli
you could even type
 root@vios# i lsmap -all

2. What is the AIX command behind an ioscli command?

If you want to know what AIX command is behind the command you issued as user padmin yo can use a special debug mode:
 $ export CLI_DEBUG=33
That's the output of the lsnports  command in this mode:
 $  lsnports
 AIX: "/usr/lib/methods/viosmgr -t npiv -f query_fc_ports >/dev/null"
 name             physloc                        fabric tports aports swwpns  awwpns
 fcs0             U789C.001.DQDH231-P1-C2-T1          1     64     64   2048    2047
 fcs1             U789C.001.DQDH231-P1-C2-T2          1     64     62   2048    2043

IOS - Information and Maintenance

1. List all ioscli commands

 $ help
You can type
 $ help 
to display a command's syntax, e.g
 $ help lsmap
Usage: lsmap {-vadapter ServerVirtualAdapter | -plc PhysicalLocationCode |
             -all} [-type BackingDeviceType ... | -net | -npiv ]
             [-field FieldName ...] [-fmt delimiter]
       lsmap -ams {-vtd PagingDevice | -all}
             [-type BackingDeviceType ... ]
             [-field FieldName ...] [-fmt delimiter]
       lsmap -clustername ClusterName {-all | -hostname}

       Displays the mapping between physical and virtual devices.

       -all          Displays mapping for all the server virtual adapter
                     devices. Defaults to VSCSI adapter devices.

       -clustername  Specifies the cluster name.

       -hostname     Specifies the host name.

       -vadapter     Specifies the server virtual adapter device
                     by device name.

       -plc          Specifies the server virtual adapter device
                     by physical location code.

       -vtd          Specifies the (AMS)Active Memory Sharing
                     Paging Device to be displayed.

       -type         Specifies to display virtual devices whose backing
                     device matches the type given.

       -net          Specifies supplied device is a virtual server
                     Ethernet adapter.

       -npiv         Displays NPIV binding information.

       -ams          Displays (AMS)Active Memory Sharing paging space
                     device information.

       -field        Specifies a list of fields to be displayed.

       -fmt          Divides output by a user-specified delimiter.

2. IOS Version

 $ ioslevel
 2.2.0.10-FP-24

3. Apply IOS Fixes

Put the IOS fixes somewhere in a local directory or on an NFS server (e.g. /mnt/iosfixes). Then run
 $ updateios -dev /mnt/iosfixes -accept

4. Reboot the VIO Server

 $ shutdown -restart

Virtual Devices: Storage

1. List unmapped disks

 $ lspv -free
 NAME            PVID                                SIZE(megabytes)
 hdisk24         none                                8631
 hdisk25         none                                8631
 hdisk26         none                                8631
 hdisk27         none                                8631
Warning: If you use vendor specific device drivers (such as the SDD or EMC drivers) you see all hdisks as free. You have to limit the list to your logical devices, e.g.
 $ lspv -free | grep vpath

2. List all Disk Mappings

 $ lsmap -all 
 
 SVSA            Physloc                                      Client Partition ID
 --------------- -------------------------------------------- ------------------
 vhost1          U9117.570.65E12FB-V1-C102                    0x0000000a

 VTD                   vtscsi1
 LUN                   0x8100000000000000
 Backing device        hdisk6
 Physloc               U7879.001.DQDHXYN-P1-C4-T1-W50050763041302AA-L4021400000000000
 
 VTD                   vtscsi8
 LUN                   0x8200000000000000
 Backing device        hdisk14
 Physloc               U7879.001.DQDHXYN-P1-C4-T1-W50050763041302AA-L4031400100000000 

VIOS Profile: Add Virtual SCSI Adapter

3. Create a Virtual SCSI Host Adapter

This has to done on the HMC for the profile of the VIO server: You create a new Virtual SCSI Host-Adapter and assign it only to your client LPAR.
The same slot ID should then be assigned to a new client adapter in the client LPAR's profile.
You can do these steps dynamically to avoid a restart of the VIO server. Use the Dynamic Logical Partitioning option for that. If you go for the dynamic option don't forget to do the same assignments in the profiles aswell, otherwise your LPAR loses all storage after a new start of the VIOS!
After dynamically adding the server hostadapters you have to rerun the configuration mamager before you can see the new vhost device:
 $ cfgdev

4. Remove a Virtual SCSI Host Adapter

 $ rmdev -dev vhostX [ -recursive ]
The option »-recursive« can be used to remove all still attached child devices.
Then remove the adapters dynamically from the VIO server aswell as from the VIOS' profile.

5. Assign a Disk/LV to a Virtual SCSI Host Adapter

To map hdisk22 to vhost1 just type
 $ mkvdev -vdev hdisk22 -vadapter vhost1
  vtscsi19 available
The VIO server assigns the next free number (19 here) and creates the mapping device vtscsi19. But you can specify your own name for the mapping device by making use of the »-dev« option:
 $ mkvdev -vdev hdisk22 -dev vthdisk22_barney -vadapter vhost1
  vthdisk22_barney available
If you use LVs rather than whole disks or LUNs the same rules apply:
 # default mapping device
 $ mkvdev -vdev lpar21_lv03 -vadapter vhost1 
  vtscsi19 available

 # custom mapping device
 $ mkvdev -vdev lpar21_lv03 -dev vtdisk21_lv03 -vadapter vhost1
  vtdisk21_lv03 available

6. Unassign a Disk/LV from a Virtual SCSI Host Adapter

 $ rmvdev -vtd vtscsiXX

Virtual Devices: Fibre Channel

IBM introduced the support of NPIV technology with VIOS (Virtual I/O Sever) 2.1 with a client AIX running either AIX 5.3 TL9 or later, or AIX 6.1 TL2 or later, or AIX 7.1. Earlier releases are not supported.

1. Create a Virtual Fibre Channel Adapter

This has to done on the HMC for the profile of the VIO server: You create a new Virtual Server Fibre Channel adapter and assign it to only one client LPAR.
The same slot ID should then be assigned to a new Client Fibre Channel adapter in the client LPAR's profile.

2. List Virtual Fibre Channels

$ lsmap -all -npiv
Name          Physloc                            ClntID ClntName       ClntOS
------------- ---------------------------------- ------ -------------- -------
vfchost0      U8203.E4A.05A6DD1-V1-C41                3 mylpar6        AIX

Status:LOGGED_IN
FC name:fcs1                    FC loc code:U789C.001.DQDH231-C3-T2
Ports logged in:2
Flags:a
VFC client name:fcs0            VFC client DRC:U8203.E4A.05A6DD1-V3-C41-T1

Name          Physloc                            ClntID ClntName       ClntOS
------------- ---------------------------------- ------ -------------- -------
vfchost1      U8203.E4A.05A6DD1-V1-C43                4 mylpar8        AIX

Status:LOGGED_IN
FC name:fcs1                    FC loc code:U789C.001.DQDH231-C3-T2
Ports logged in:2
Flags:a
VFC client name:fcs0            VFC client DRC:U8203.E4A.05A6DD1-V4-C43-T1


3. List NPIV Capable Ports

NPIV = N_port ID Virtualization
$ lsnports
name             physloc                        fabric tports aports swwpns  awwpns
fcs0             U789C.001.DQDH231-P1-C2-T1          1     64     64   2048    2047
fcs1             U789C.001.DQDH231-P1-C2-T2          1     64     62   2048    2043

4. Assign a Physical FC Adapter to a Virtual Fibre Channel Adapter

$ vfcmap -vadapter vfchost0 -fcp fcs1

5. Unassign a Physical FC Adapter from a Virtual Fibre Channel Adapter

There isn't a separate command for this action - you just leave the argument after -fcp  empty:
$ vfcmap -vadapter vfchost0 -fcp

Virtual Devices: Network

1. List Shared Ethernet Adapters

 $ lsmap -all -net
 SVEA Physloc
 ------ --------------------------------------------
 ent12 U9117.570.65E12FB-V2-C20-T1

 SEA                   ent13
 Backing device        ent3
 Physloc               U7311.D20.651372C-P1-C01-T2

2. Create a Shared Ethernet Adapter

To create a Shared Ethernet Adapter (SEA) you need:
  • a physical adapter as backend: 
  • a virtual adapter as defined in the VIOS' profile: 
  • an internal VLAN ID: 
If you use the Shared Ethernet Adapter Failover capability of recent IOS releases you also need
  • a second virtual adapter as defined in the VIOS' profile: 
for the control channel:
 # simple:
 $ mkvdev -sea  -vadapter  -default  -defaultid 

 # Shared Ethernet Adapter Failover:
 $ mkvdev -sea  -vadapter  -default  -defaultid  -attr ha_mode=auto ctl_chan=
Example: To create a Shared Ethernet Adapter on top of an virtual adapter ent11 using VLAN 20, the physical adapter ent2 as backend, and the virtual adapter ent13for the control channel type:
 $ mkvdev -sea ent2 -vadapter ent11 -default ent11 -defaultid 20 -attr ha_mode=auto ctl_chan=ent13

3. List Links on Physical Ethernet Adapters

 $ netstat -cdlistats | grep -Ei "\(ent|media|link status"
 ETHERNET STATISTICS (ent3) : 
 Link Status : Up 
 Media Speed Selected: 100 Mbps Full Duplex
 Media Speed Running: 100 Mbps Full Duplex 

4. Set a local IP Address

To configure an local IP 192.168.1.2 address to en0 use
 $ mktcpip  -hostname  \
            -inetaddr 192.168.1.2 \
            -interface en0 -start \
            -netmask 255.255.255.0 \
            -gateway 

5. Remove a local IP Address

If you want to remove the IP configuration from en0, type
 $ rmtcpip -interface en0


NIM Commands

NIM Commands

Contents

  1. Introduction: Objects and Classes
  2. Command Overview
    1. Listing all defined NIM objects
    2. Listing all defined objects of a specific type
    3. Showing an object's definition
    4. Defining an LPP source
    5. Defining a network
    6. Defining a NIM client
    7. Defining an MKSYSB resource
    8. Defining an image_data resource
    9. Creating a spot from an LPP source
    10. Creating a spot from an MKSYSB
    11. Prepare spot and LPP source for an Alternate Disk Migration
    12. Modifying a client definition
    13. Re-initializing a client
    14. Installing a client
    15. Installing a client with an MKSYSB image
    16. Reset a NIM client
    17. Query a client for installed APARs
    18. Enabling a maintenance boot
    19. Start an Alternate Disk Migration
  3. Related Information

A. Introduction: Objects and Classes

NIM (the Network Installation Manager) stores all information needed for the installation of servers in objects. Objects are organized in object types and object classes. Here is an overview of the most important object types and classes:
ClassTypeDescription
machinesstandalonethe client LPAR to be installed via NIM
networksentnetwork definition (network address, gateway)
resourceslpp_sourcea set of AIX filesets
resourcesmksysban mksysb image
resourcesspota /usr filesystem
resourcesfb_scriptscript, to be executed during the first boot after installation
resourcesscripta postinstall script

B. Command Overview


1. Listing all defined NIM objects

# lsnim

2. Listing all defined objects of a specific type

# lsnim -t <type>

3. Showing an object's definition

# lsnim -l <object>

4. Defining an LPP source

# nim -o define -t lpp_source \
            -a server=master \
            -a location=</path/to/bffs> \
            -a comments=<free text> \
        <lpp source>

5. Defining a network

# nim -o define -t ent \
          -a net_addr=<netaddress>  \
          -a snm=<netmask>  \
          -a routing1="default <gateway>" \
       <network>

6. Defining a NIM client

# nim -o define -t standalone \
           -a platform=chrp \
           -a netboot_kernel=64 \
           -a if1="<network> <ip label> 0 ent" \
           -a cable_type1=tp \
        <client>
You could also use an ip address instead of an ip label here

7. Defining an MKSYSB resource

# nim -o define -t mksysb \
        -a server=master \
        -a comments="<free text>" \
        -a location=<directory> \
    <mksysb>

8. Defining an image_data resource

# nim -o define -t image_data \
        -a server=master \
        -a comments="<free text>" \
        -a location=</path/to/image_data> \
    <image_data>

9. Creating a spot from an LPP source

# nim -o define -t spot \
            -a server=master \
            -a source=<lpp source> \
            -a location=<directory> \
            -a comments="<free text>" \
        <spot>

10. Creating a spot from an MKSYSB

# nim -o define -t spot \
        -a server=master \
        -a source=<mksysb> \
        -a location=<directory> \
        -a comments="<free text>" \
    <spot>
Use the base directory for your spots here rather than a spot specific directory. NIM automatically creates a subdirectory with the name of the spot object: <spot>

11. Prepare spot and LPP source for an Alternate Disk Migration

# nimadm -M -s <spot> -l <lpp source> -d <source directory>
In <source directory> NIM searches for the two filesets «bos.alt_disk_install.rte» and «bos.alt_disk_install.boot_images». nimadm then updates spot and LPP source with these two filesets. This way you can migrate a client to a lower AIX level then the level of the NIM server itself. This feature has been added to NIM with AIX 7.1.

12. Modifying a client definition

# nim -o change -a <attribute>=<value> <client>
You find the exact names of valid attributes in the output of lsnim -l . The option change is used to change the value of an attribute, e.g. if you want to change a client's netboot kernel from 64 to mp you would type:
# nim -o change -a netboot_kernel=mp <client>

13. Re-initializing a client

If a client's /etc/niminfo is out of date. It can be rewritten by the below procedure:
client# rm /etc/niminfo
client# niminit -a name=<client> -a master=<nimserver> -a connect=nimsh¹
This procedure is useful if you want to move a client from one NIM server to another. In this case remember to first create the client on the server before running this procedure.

¹ "-a connect=nimsh" is optional and only required if you don't want the NIM server to communicate via rsh with the client.

14. Installing a client

# nim -o bos_inst \
           -a spot=<spot> \
           -a lpp_source=<lpp source> \
           -a fb_script=<script> \
           -a script=<postinstall script> \
           -a no_client_boot=yes \
           -a accept_licenses=yes \
        <client>
Use the option no_client_boot=yes if you don't want NIM to initiate a reboot of your LPAR over rsh. You have to manually boot the LPAR from the SMS menu then - what is probably what you want.

15. Installing a client with an MKSYSB image

# nim -o bos_inst \
           -a source=mksysb \
           -a spot=<spot> \
           -a mksysb=<mksysb> \
           -a lpp_source=<lpp source> \
           -a fb_script=<script> \
           -a script=<postinstall script> \
           -a no_client_boot=yes \
           -a accept_licenses=yes \
        <client>

16. Reset a NIM client

# nim -F -o reset <client>
resets a NIM client so new operations can be done. Please note that often it's not enough to just reset a NIM object because there are still resources allocated for the client. You find all resources still allocated to the client with lsnim -l . They can be removed with:
# nim -o deallocate -a spot=<spot> -a ...=... <client>
To remove all resources from a client simply run:
# nim -o deallocate -a subclass=all <client>

17. Query a client for installed APARs

# nim -o fix_query <client>
This command is useful to check for your nimserver can reach the client.

18. Enabling a maintenance boot

# nim -o maint_boot -a spot=<spot> <client>
Now you can boot your client over the network into a maintenance shell.

19. Start an Alternate Disk Migration

# nimadm -c <client> -l <lpp source> -s <spot> -d <hdisk> -Y

C. Related Information