PDF

Scripting IBM AIX LPAR builds from A to Z in an IBM
PowerVM environment
Brian K. Smith ([email protected])
System Administrator
US Department of Homeland Security
07 February 2013
In today's high demand and quickly changing IT environment, many system administrators are
looking for areas where they can save time and automate tasks. Creating a logical partition
(LPAR) creation is a common task that when manually done takes a significant amount of time.
In other words, it is a perfect task to automate! This article covers the steps to create a LPAR
from the command line and then show how this can be automated with a script.
Introduction
Creating an LPAR in an IBM® PowerVM® environment can be a complicated task. You need
to perform the following high-level steps to build an LPAR using virtual Small Computer System
Interface (VSCSI), N-Port ID Virtualization (NPIV), or shared storage pools in a dual Virtual I/O
Server (VIOS) environment.
In this example, the two VIOS names are VIO1 and VIO2.
From the Hardware Management Console (HMC) command line, perform the following tasks:
• Create an LPAR profile with two virtual SCSI client adapters (virtual SCSI or shared storage
pool) or two virtual Fibre Channel (FC) client adapters (NPIV).
• Use DLPAR to add virtual SCSI server adapters or virtual Fibre Channel server adapters to
VIO1 and VIO2.
• Save the current configurations of VIO1 and VIO2 to their profiles using the Save Current
Configuration function of the HMC.
• Run the cfgdev command on VIO1 and VIO2 to detect new adapters.
• Look up the virtual host (vhost) adapters on the VIO1 and VIO2 servers based on slot
numbers to find the correct vhost or vfchost devices.
• For virtual SCSI, map the storage from VIO1 and VIO2 to the vhost device.
• For NPIV, map the virtual Fibre Chanel adapter to a physical adapter on VIO1 and VIO2.
• For shared storage pool, create a logical unit number (LUN) and map it to the vhost adapter
on VIO1 and VIO2.
© Copyright IBM Corporation 2013
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Trademarks
Page 1 of 11
developerWorks®
ibm.com/developerWorks/
From the Network Installation Management (NIM) server:
• Add a server to the /etc/hosts file.
• Define the new LPAR as a NIM client.
• Configure NIM to push out a mksysb to the server with an optional bosinst_data resource.
Back on the HMC command line:
• Boot the LPAR from the network.
• Open a console connection to the LPAR.
• After mksysb is restored and AIX is started, complete system configuration and customization
as needed.
This article covers the steps needed to manually create an LPAR from the command line and also
shows how these tasks can be automated with a script.
Manually creating an LPAR from the command line
The first step in creating an LPAR is to understand the architecture of the system where you are
building the LPAR. This article is geared towards a virtualized PowerVM environment with VIOS
instances. However, it would be possible to adapt the steps for a non-virtualized environment as
well, as long as the system is HMC-managed.
In a virtualized environment, you have several options. For storage, you can use traditional virtual
SCSI, NPIV, or shared storage pools. For networking in a virtualized environment, most people use
virtual Ethernet.
This article provides detailed information on creating a new LPAR in an NPIV environment with
dual VIOS instances. However, you can adapt these directions for virtual SCSI and shared storage
pools if that is used in your environment.
Let us go into detail about the steps listed above to create an LPAR from the command line that
will use NPIV.
Create the LPAR profile from the HMC command line
The mksyscfg HMC command is used to create the LPAR and you can specify parameters such
as the LPAR name, the virtual Ethernet VLAN ID to use, the virtual Fibre Channel adapter slot
numbers, minimum/maximum/desired CPU, virtual processor, and memory. Listing 1 shows an
example command line to create an LPAR profile.
Listing 1. An example of the mksyscfg command to create an LPAR profile
mksyscfg -r lpar -m p770_01 -i "name=applpar01, profile_name=applpar01,lpar_env=aixlinux,
min_mem=8192, desired_mem=16384, max_mem=24576, proc_mode=shared, min_procs=1,
desired_procs=2, max_procs=4, min_proc_units=0.5, desired_proc_units=1, max_proc_units=2,
sharing_mode=uncap, uncap_weight=128, conn_monitoring=1, boot_mode=norm,
max_virtual_slots=200, \"virtual_eth_adapters=2/0/5//0/0/\",
\"virtual_fc_adapters=25/client//vioprod1/25//0,26/client//vioprod2/26//0\" "
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 2 of 11
ibm.com/developerWorks/
developerWorks®
Most of the command line is self-explanatory. The tricky parts are the virtual adapters.
The important parts of the virtual_eth_adapter section (\"virtual_eth_adapters=2/0/5//0/0/
\") 2 which specifies slot 2, and 5 which specifies VLAN ID 5.
The important parts of the virtual_fc_adapters section (\"virtual_fc_adapters=25/client//
vioprod1/25//0,26/client//vioprod2/26//0\") are the local/remote slot numbers (25 and 26 in
the example) and the VIOS names.
Refer to the HMC man page for more information about the mksyscfg command syntax.
Make sure to escape the quotation marks around the virtual_eth_adapters and
virtual_fc_adapters so that the shell does not strip them off when you run the command.
Use DLPAR to add the virtual server adapters to the VIOS instances The HMC chhwres command
can be used to dynamically add (DLPAR) virtual server adapters into the VIOS instances. An
example command is shown in Listing 2.
Listing 2. Example of "chhwres" command lines to DLPAR virtual server
adapters in two VIOS instances
chhwres -r virtualio -m p770_01 -o a -p vioprod1 --rsubtype fc -s 25 -a
"adapter_type=server,remote_lpar_name=applpar01,remote_slot_num=25"
chhwres -r virtualio -m p770_01 -o a -p vioprod2 --rsubtype fc -s 26 -a
"adapter_type=server,remote_lpar_name=applpar01,remote_slot_num=26"
This will add the corresponding VIOS adapters needed to support the client adapters we created in
the LPAR profile.
The -m flag specifies the name of the managed system.
The -p flag specifies the name of the VIOS.
-s 25
specifies the VIOS slot number.
remote_lpar_name=
remote_slot_num=
is the name of the LPAR client.
is the corresponding slot number on the client.
In these examples the VIOS slot and the client slot are the same.
Save the current configuration of VIOS instances to their profiles
At this point, the virtual server adapters have been dynamically added to the VIOS instances.
However, the VIOS profiles do not have them. If the VIOS instance are shut down and reactivated,
the adapters would be lost unless they are put in the profiles. One way to accomplish this is to
save the current configuration of the VIOS instances to their profiles. This can be done by using
the mksyscfg HMC command. An example of the mksyscfg command is shown in Listing 3.
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 3 of 11
developerWorks®
ibm.com/developerWorks/
Listing 3. An example of "mksyscfg" command lines to save current
configuration of VIOS intances to their profiles
mksyscfg -r prof -m p770_01 -o save -p
"lpar_names=vioprod1" -F curr_profile`
mksyscfg -r prof -m p770_01 -o save -p
"lpar_names=vioprod2" -F curr_profile`
vioprod1 -n `lssyscfg -r lpar -m p770_01
--force
vioprod2 -n `lssyscfg -r lpar -m p770_01
--force
--filter
--filter
The occurrences of p770_01 specify the managed system name. vioprod1 and vioprod2 are the
VIOS names. When these commands are run, the lssyscfg command is evaluated first, which
returns the current profile name for the LPAR. The mksyscfg part of the command is then evaluated
which saves the running configuration to the profile returned from lssyscfg.
Run cfgdev on the VIOS instances to detect the new virtual adapters
The VIOS virtual adapters have now been dynamically added (using DLPAR) to the VIOS
instances and also saved to their profiles. The next step is to run the cfgdev command on
the VIOS instances so that the vfchost devices are created. This can be done using the HMC
viosvrcmd command to run a remote command on each VIOS. This is shown in Listing 4.
Listing 4. An example of the HMC "viosvrcmd" command to run cfgdev on
each VIOS
viosvrcmd -m p770_01 -p vioprod1 -c "cfgdev -dev vio0"
viosvrcmd -m p770_01 -p vioprod2 -c "cfgdev -dev vio0"
The –dev vio0 parameter causes cfgdev to only walk down the vio0 device which is much faster
than running a full cfgdev (which scans all devices).
Determine the vfchost devices on each VIOS
Now that cfgdev has been run, the vfchost adapters have been created on each VIOS. The next
step is to find the correct vfchost device name for the adapters we just created. This is done by
using the HMC viosvrcmd command to run lsmap –all –npiv on each VIOS and then grepping for
the slot number of the adapters we just added. Listing 5 shows the command line needed for this.
Listing 5. An example of the "viosvrcmd" command to run "lsmap" on VIOS to
find correct vhost devices
viosvrcmd -m p770_01 -p vioprod1 -c "lsmap -all -npiv" | grep "\-C25 " | cut -f 1 -d " "
viosvrcmd -m p770_01 -p vioprod2 -c "lsmap -all -npiv" | grep "\-C26 " | cut -f 1 -d " "
Slot 25 was the slot added to vioprod1, and slot 26 was the slot added to vioprod2, so we grep for
these numbers. Each command returns a vfchost device name, such as vfchost1 or vfchost2.
Map the virtual Fibre Channel adapter to a physical adapter
Now that we know the vfchost devices for each VIOS, we can map these to physical adapters.
This can be done using the viosvrcmd command to run the vfcmap command on the VIOS, as
shown is Listing 6.
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 4 of 11
ibm.com/developerWorks/
developerWorks®
Listing 6. An example of "viosvrcmd" to run "vfcmap" on each VIOS
viosvrcmd -m p770_01 -p vioprod1 -c "vfcmap -vadapter vfchost1 -fcp fcs0"
viosvrcmd -m p770_01 -p vioprod2 -c "vfcmap -vadapter vfchost1 -fcp fcs0"
Replace vfchost1 with the devices you found in Listing 5. Note that the vfchost devices could have
the same device names on both VIO1 and VIO2 or they might have different names (for example,
vfchost3 on VIO1 and vfchost4 on VIO2). Replace fcs0 with the physical Fibre Channel adapter
that you would want the adapters to be mapped to.
Display the WWPNs of the adapters
At this point ,the worldwide port names (WWPNs) of the NPIV adapters can be retrieved so that
storage area network (SAN) zoning can take place. Use the lssyscfg HMC command to display
the WWPNs using a command, such as the one shown in Listing 7.
Listing 7. An example of the "lssyscfg" command to display NPIV WWPNs
lssyscfg -r prof -m p770_01 --filter lpar_names=applpar01 -F name,virtual_fc_adapters |
sed -e 's/""*[0-9]*\/client\/[0-9]*\/[a-zA-Z0-9]*\/[0-9]*\///g' -e 's/\/0""*//g'
You should now ask your SAN administrator to zone the WWPNs and provision the storage.
Add LPAR as a NIM client and set up mksysb install
At this point, all of the commands have been run from the HMC. We now need to move over to the
NIM server to complete a few tasks there. First, we will add the new LPAR client to the /etc/hosts
file using the AIX hostent command. An example of the hostent command line to run on the NIM
server is shown in Listing 8.
Listing 8. Adding an LPAR to /etc/hosts on the NIM server using the "hostent"
command
hostent -a 192.168.0.3 -h applpar01
We can then configure the new LPAR as a NIM client, as shown in Listing 9.
Listing 9. An example command to configure LPAR as a NIM client
nim -o define -t standalone -a platform=chrp -a if1="find_net applpar01 0" -a
cable_type1=tp -a net_settings1="auto auto" -a netboot_kernel=64 applpar01
Next, configure NIM to push out a mksysb, as shown in Listing 10.
Listing 10. An example command to configure NIM to push out mksysb to
LPAR
nim -o bos_inst -a source=mksysb -a spot=spot61 -a mksysb=aix61 -a
accept_licenses=yes -a installp_flags=-acNgXY -a no_client_boot=yes -a preserve_res=yes
applpar01
In the above command, spot=spot61 and mksysb=aix61 specify the names of the NIM resources
that will be used to complete the installation. You can also specify the name of a bosinst_data
resource to further automate the mksysb installation.
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 5 of 11
developerWorks®
ibm.com/developerWorks/
Boot the LPAR from the network and open a console
For the final few steps, we need to move back to the HMC and use the lpar_netboot command to
start LPAR from the NIM server, as shown in Listing 11.
Listing 11. An example of the "lpar_netboot" command to boot LPAR from NIM
server
lpar_netboot -t ent -s auto -d auto -D -S 192.168.0.5 -G 192.168.0.1 -C 192.168.0.3 -K
255.255.255.0 applpar01 applpar01 p770_01
In the above command, -S 192.168.0.5 specifies the NIM server’s IP address, -G 192.168.0.1
specifies the gateway, and -C 192.168.0.3 specifies the LPAR’s IP address.
The last step is to open a console connection to the LPAR using the mkvterm command, as shown
in Listing 12.
Listing 12. "mkvterm" command to open console connection to LPAR
mkvterm -m p770_01 -p applpar01
Scripting the LPAR creation process
The next step after understanding how to manually create the LPAR from the command line is to
script the tasks.
The script presented in this article is just an example. It must be customized and tested to work
in your specific environment. For example, it makes certain assumptions such that your LPAR
uses a 255.255.255.0 subnet with a default gateway that ends in “.1”. It is set up to add two virtual
Fibre Channel adapters and one virtual Ethernet adapter, but can easily be customized to add
more of these adapters, if needed. You need to carefully review the script and make changes as
appropriate for your environment, and then test the script in a test environment before using in
production.
The input to the LPAR creation script is a CSV format file. CSV is a great format to use because it
is easy to parse in a script, and it is very easy to edit with spreadsheets, such as LibreOffice Calc
or Microsoft® Excel.
The input file should be edited in the spreadsheet application and each row of the spreadsheet
specifies the attributes for an LPAR. You can specify as many LPARs in the file as you would need.
Figure 1 shows the CSV file being edited in a spreadsheet application.
Figure 1. Editing the CSV input file in a spreadsheet application
To create the CSV file with proper headers, download the input.csv file shown in Listing 13.
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 6 of 11
ibm.com/developerWorks/
developerWorks®
Listing 13. Column headers to set as first line of CSV input file
Download:
input.csv
The columns are:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
LPAR_name – Name of the new LPAR that will be created
System – Managed system name that the LPAR will be created on
VFC1_LPAR_slot – Client/LPAR slot number for the virtual FC adapter that will go to VIO1
VFC1_VIO1_slot – Server/VIOS slot number for the virtual FC adapter for VIO1
VFC2_LPAR_slot – Client/LPAR slot number for the virtual FC adapter that will go to VIO2
VFC2_VIO2_slot – Server/VIOS slot number for the virtual FC adapter for VIO2
eth_slot2_vlan – The virtual LAN (VLAN) ID to use for a virtual Ethernet adapter on client slot
2
vio1 – Name of the VIO1 server
vio2 – Name of the VIO2 server
vcpu_min – Minimum virtual CPU
vcpu_desired – Desired virtual CPU
vcpu_max – Maximum virtual CPU
cpu_min – Minimum CPU
cpu_desired – Desired CPU
cpu_max – Maximum CPU
mem_min – Minimum memory (specified in gigabytes)
mem_desired – Desired memory (specified in gigabytes)
mem_max – Maximum memory (specified in gigabytes)
server_ip – The IP address of the LPAR you are creating
nim_ip – The NIM server's IP address
mksysb – the NIM mksysb resource you need to use
spot – the NIM spot resource you would like to use
All fields are required in each line of the file.
Listing 14 has a link to download an example input file that specifies two LPARs to be created.
Listing 14. Example input CSV file that specifies two LPARs to be created.
Download: example.csv
The script, named csvtolpar.pl, is run with the CSV file name specified on the command line with a
command, such ./csvtolpar.pl input.csv
The output of the script is all of the command lines needed to create the LPARs. Sample output of
the script is shown in Listing 15.
Listing 15. Output of the csvtolpar.pl script that shows the commands needed
to create two LPARs
#Create LPAR, you can customize things such as the uncapped weight, max virtual slots,
etc.or add in extra parameters for things such as AME
mksyscfg -r lpar -m p770_01 -i "name=applpar01, profile_name=applpar01,
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 7 of 11
developerWorks®
ibm.com/developerWorks/
lpar_env=aixlinux, min_mem=8192, desired_mem=16384, max_mem=24576,
proc_mode=shared, min_procs=1, desired_procs=2, max_procs=4,
min_proc_units=0.5, desired_proc_units=1, max_proc_units=2,
sharing_mode=uncap, uncap_weight=128, conn_monitoring=1,
boot_mode=norm, max_virtual_slots=200,
\"virtual_eth_adapters=2/0/5//0/0/\",
\"virtual_fc_adapters=25/client//vioprod1/25//0,26/client//vioprod2/26//0\" "
#DLPAR in virtual adapters to VIO servers
chhwres -r virtualio -m p770_01 -o a -p vioprod1 --rsubtype fc -s 25 -a
"adapter_type=server,
remote_lpar_name=applpar01,remote_slot_num=25"
chhwres -r virtualio -m p770_01 -o a -p vioprod2 --rsubtype fc -s 26 -a
"adapter_type=server,
remote_lpar_name=applpar01,remote_slot_num=26"
#Save current config for VIO servers to profiles
mksyscfg -r prof -m p770_01 -o save -p vioprod1 -n `lssyscfg -r lpar -m p770_01
--filter "lpar_names=vioprod1" -F curr_profile` --force
mksyscfg -r prof -m p770_01 -o save -p vioprod2 -n `lssyscfg -r lpar -m p770_01
--filter "lpar_names=vioprod2" -F curr_profile` --force
#Run cfgdev on VIO servers to detect new virtual adapters
viosvrcmd -m p770_01 -p vioprod1 -c "cfgdev -dev vio0"
viosvrcmd -m p770_01 -p vioprod2 -c "cfgdev -dev vio0"
#Determine what the vhost device is for each VIO
vio1_vhost=`viosvrcmd -m p770_01 -p vioprod1 -c "lsmap -all -npiv" | grep "\-C25 " |
cut -f 1 -d " " `
vio2_vhost=`viosvrcmd -m p770_01 -p vioprod2 -c "lsmap -all -npiv" | grep "\-C26 " |
cut -f 1 -d " " `
echo "VIO1=$vio1_vhost
VIO2=$vio2_vhost"
#Map virtual fibre channel - Customize physical fcs adapter here
viosvrcmd -m p770_01 -p vioprod1 -c "vfcmap -vadapter $vio1_vhost -fcp fcs0"
viosvrcmd -m p770_01 -p vioprod2 -c "vfcmap -vadapter $vio2_vhost -fcp fcs0"
#Display WWPN's for zoning
lssyscfg -r prof -m p770_01 --filter lpar_names=applpar01 -F name,
virtual_fc_adapters | sed -e 's/""*[0-9]*\/client\/[0-9]*\/[a-zA-Z0-9]*\/[0-9]*\///g'
-e 's/\/0""*//g'
#NIM Commands to add to hosts, define as client, and push out mksysb,
***run these commands on NIM server***, add " -a connect=nimsh" to
define command line if using nimsh hostent -a 192.168.0.3 -h applpar01
nim -o define -t standalone -a platform=chrp -a if1="find_net applpar01 0"
-a cable_type1=tp -a net_settings1="auto auto" -a netboot_kernel=64 applpar01
nim -o bos_inst -a source=mksysb -a spot=spot61 -a mksysb=aix61
-a accept_licenses=yes -a installp_flags=-acNgXY -a no_client_boot=yes -a preserve_res=yes
applpar01
#HMC Netboot command and console command, Warning, this will REBOOT the LPAR if
it is running
lpar_netboot -t ent -s auto -d auto -D -S 192.168.0.5 -G 192.168.0.1
-C 192.168.0.3 -K 255.255.255.0 applpar01 applpar01 p770_01
mkvterm -m p770_01 -p applpar01
########################################################################################
#Create LPAR, you can customize things such as the uncapped weight, max virtual slots,
etc.or add in extra parameters for things such as AME
mksyscfg -r lpar -m p770_01 -i "name=applpar02, profile_name=applpar02,
lpar_env=aixlinux, min_mem=4096, desired_mem=8192, max_mem=12288,
proc_mode=shared, min_procs=1, desired_procs=1, max_procs=1,
min_proc_units=0.1, desired_proc_units=0.5, max_proc_units=1,
sharing_mode=uncap, uncap_weight=128, conn_monitoring=1,
boot_mode=norm, max_virtual_slots=200,
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 8 of 11
ibm.com/developerWorks/
developerWorks®
\"virtual_eth_adapters=2/0/5//0/0/\", \"virtual_fc_adapters=27/client//vioprod1/27//0,
28/client//vioprod2/28//0\" "
#DLPAR in virtual adapters to VIO servers
chhwres -r virtualio -m p770_01 -o a -p vioprod1 --rsubtype fc -s 27 -a
"adapter_type=server,remote_lpar_name=applpar02,remote_slot_num=27"
chhwres -r virtualio -m p770_01 -o a -p vioprod2 --rsubtype fc -s 28 -a
"adapter_type=server,remote_lpar_name=applpar02,remote_slot_num=28"
#Save current config for VIO servers to profiles
mksyscfg -r prof -m p770_01 -o save -p vioprod1 -n
`lssyscfg -r lpar -m p770_01 --filter "lpar_names=vioprod1" -F curr_profile` --force
mksyscfg -r prof -m p770_01 -o save -p vioprod2 -n
`lssyscfg -r lpar -m p770_01 --filter "lpar_names=vioprod2" -F curr_profile` --force
#Run cfgdev on VIO servers to detect new virtual adapters
viosvrcmd -m p770_01 -p vioprod1 -c "cfgdev -dev vio0"
viosvrcmd -m p770_01 -p vioprod2 -c "cfgdev -dev vio0"
#Determine what the vhost device is for each VIO
vio1_vhost=`viosvrcmd -m p770_01 -p vioprod1 -c "lsmap -all -npiv" | grep
"\-C27 " | cut -f 1 -d " " `
vio2_vhost=`viosvrcmd -m p770_01 -p vioprod2 -c "lsmap -all -npiv" | grep
"\-C28 " | cut -f 1 -d " " `
echo "VIO1=$vio1_vhost
VIO2=$vio2_vhost"
#Map virtual fibre channel - Customize physical fcs adapter here
viosvrcmd -m p770_01 -p vioprod1 -c "vfcmap -vadapter $vio1_vhost -fcp fcs0"
viosvrcmd -m p770_01 -p vioprod2 -c "vfcmap -vadapter $vio2_vhost -fcp fcs0"
#Display WWPN's for zoning
lssyscfg -r prof -m p770_01 --filter lpar_names=applpar02 -F name,
virtual_fc_adapters | sed -e 's/""*[0-9]*\/client\/[0-9]*\/[a-zA-Z0-9]*\/[0-9]*\///g'
-e 's/\/0""*//g'
#NIM Commands to add to hosts, define as client, and push out mksysb,
***run these commands on NIM server***, add " -a connect=nimsh" to define
command line if using nimsh
hostent -a 192.168.0.4 -h applpar02
nim -o define -t standalone -a platform=chrp -a if1="find_net applpar02 0"
-a cable_type1=tp -a net_settings1="auto auto" -a netboot_kernel=64 applpar02
nim -o bos_inst -a source=mksysb -a spot=spot61 -a mksysb=aix61
-a accept_licenses=yes -a installp_flags=-acNgXY -a no_client_boot=yes
-a preserve_res=yes applpar02
#HMC Netboot command and console command, Warning, this will
REBOOT the LPAR if it is running
lpar_netboot -t ent -s auto -d auto -D -S 192.168.0.5 -G 192.168.0.1
-C 192.168.0.4 -K 255.255.255.0 applpar02 applpar02 p770_01
mkvterm -m p770_01 -p applpar02
########################################################################################
The csvtolpar.pl script does not make any changes on your system. It simply displays the
commands that need to be run for the LPAR to be created. These command lines can be quickly
copied in to the HMC and NIM servers; or if you have Secure Shell (SSH) keys set up, you can
modify the script to run the commands over SSH rather than just displaying the commands that
need to be run. I prefer to copy the commands, so that I can ensure that each step is working as
intended.
If you save your input CSV file, you can easily re-create the LPARs anytime in the future, or adapt
the CSV files to easily create similar LPARs.
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 9 of 11
developerWorks®
ibm.com/developerWorks/
The csvtolpar.pl script is a Perl script and is available for download in Listing 16.
Listing 16. csvtolpar.pl Perl script
Download: csvtolpar.pl
Conclusion
This article has covered the steps to manually create a LPAR from the command line and
also provided an example script to automate creating LPARs that can be customized for your
environment. Automating LPAR builds can save a significant amount of time and allow you to meet
the ever-increasing business demands.
Resources
• Refer to the online IBM reference page for HMC commands
• Refer to NIM from A to Z in AIX 5L from IBM Redbooks®
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 10 of 11
ibm.com/developerWorks/
developerWorks®
About the author
Brian K. Smith
Brian Smith is a UNIX/Linux system administrator and lives in Colorado Springs,
Colorado, with his wife and two children. He has worked with IBM AIX for the last
seven years. His areas of expertise include AIX, IBM PowerVM, shell scripting, Perl
programming, and Linux. You can find more information about his work at Brian
Smith's AIX / UNIX / Linux / open source blog.
© Copyright IBM Corporation 2013
(www.ibm.com/legal/copytrade.shtml)
Trademarks
(www.ibm.com/developerworks/ibm/trademarks/)
Scripting IBM AIX LPAR builds from A to Z in an IBM PowerVM
environment
Page 11 of 11