How to create a basic WPAR(Workload Partition) in AIX 6.1
To demonstrate the simplicity of creating a Workload Partition within AIX 6.1 via CLI, here’s a quick example. The WPAR commands in AIX are pretty easy to figure out. You can even guess what they are, using the standard AIX file naming convention; mkwpar, lswpar, startwpar, stopwpar, chwpar, etc. If you prefer the GUI type of configuration, there is also a web based Workload Partition Manager tool that IBM introduced. Please see the AIX Version 6.1 IBM Workload Partitions Manager for AIX Redbook for more information.
Start out by creating the WPAR using the mkwpar command.
bash-3.00# mkwpar
mkwpar: 0960-046 Workload partition name is required.
Usage: mkwpar [-a] [-A] [-b devexportsFile] [-B wparBackupDevice] [-c]
[-d directory] [-D attr=value ...] … [-F] [-g vg ]
[-h hostName] [-l] [-L attr=value ...] [-M attr=value ...] …
[-N attr=value ...] … [-P] [-r] [-R attr=value ...]
[-S attr[+|-]=value …] [-s] [-u /path/to/script] [-v]
{ -n wparName [-p [name]] [-e existing_wpar | -f inFile] [-o outFile [-w]]
| -p name [-n wparName] [-e existing_wpar | -f inFile] [-o outFile [-w]]
| -f inFile [-n wparName] [-p [name]] [-o outFile [-w]]
| -w -o outFile [-n wparName] [-p [name]] [-f inFile | -e existing_wpar] }Flags:
-a = Automatically resolve erroneous/conflicting settings.
-A = Start automatically on system boot.
-b = Path to permitted device exports file.
-B = Device or Pathname of savewpar backup image.
-c = Flag as checkpointable.
-d = Base directory.
-D = Override default device exports (devname, devtype, export).
-e = Get specification data from existing workload partition.
-f = Path to input specification file.
-F = Force - ignore certain errors.
-g = Default volume group for local file systems.
-h = Hostname.
-l = Create private, writeable versions of /usr and /opt.
-L = Logical volume management policy (image_data, shrink, ignore_maps).
-M = Mount settings (dev, directory, vfs, size, crfsopts, mode,
vg, logname, host, mountopts).
-n = Workload partition name.
-N = Network settings (interface, address, netmask, broadcast).
-o = Path to output specification file.
-p = Preserve file system data from the named mount group.
-P = Set workload partition root password interactively.
-r = Copy global network name resolution configuration into the workload
partition.
-R = Resource control settings (active, rset, CPU, memory, procVirtMem,
shares_CPU, shares_memory, totalProcesses, totalThreads).
-S = Configures the security settings of a workload partition (secfile, privs[+|-]).
-s = Start after creation.
-u = User script to execute on start & stop.
-v = Verbose mode.
-w = Only write specification file (do not create).
I am just creating a basic WPAR with a writable /usr and /opt. If -l is not specified, this WPAR will contain a loop back mounted fs for /usr and /opt using the global WPARs filesystem. You will obviously not be able to install any WPAR specific software that requires writing to /usr or /opt, unless your in the global WPAR. -a tells the WPAR to boot upon system boot, or global WPAR boot. -n will define the WPAR name, which shows up in the global WPAR. -h will define the hostname of the WPAR, and will grab its ethernet address from /etc/hosts.
bash-3.00# mkwpar -a -h wpar1 -l -n wpar1 -v
mkwpar: Creating file systems…
/
/home
/opt
/proc
/tmp
/usr
/var
Mounting all workload partition file systems.
mkwpar: Copying base files…
…
syncroot: Installing RPM file: /var/ssl/openssl.cnf
syncroot: RPM root packages are currently synchronized.
syncroot: Root part is currently synchronized.
syncroot: Returns Status = SUCCESS
Workload partition wpar1 created successfully.
mkwpar: 0960-390 To start the workload partition, execute the following as root: startwpar [-v] wpar1
mkwpar will create new logical volumes for the WPAR to live on. It will then make a copy of the running AIX instance and prepare the WPAR for boot.
’startwpar’ is the command you will boot the WPAR with.
bash-3.00# startwpar -v wpar1
Starting workload partition wpar1.
Mounting all workload partition file systems.
Mounting /wpars/wpar1
Mounting /wpars/wpar1/home
Mounting /wpars/wpar1/opt
Mounting /wpars/wpar1/proc
Mounting /wpars/wpar1/tmp
Mounting /wpars/wpar1/usr
Mounting /wpars/wpar1/var
Loading workload partition.
…
Exporting workload partition devices.
Starting workload partition subsystem cor_wpar1.
0513-059 The cor_wpar1 Subsystem has been started. Subsystem PID is 876724.
Verifying workload partition startup.
Return Status = SUCCESS.
Once the WPAR is booted, you can check the status by using ‘lswpar’
bash-3.00# lswpar
Name State Type Hostname Directory
—————————————————————-
wpar1 A S wpar1 /wpars/wpar1
Now that the WPAR is online, you can telnet to it
bash-3.00# clogin wpar1
*******************************************************************************
* *
* *
* Welcome to AIX Version 6.1! *
* *
* *
* Please see the README file in /usr/lpp/bos for information pertinent to *
* this release of the AIX Operating System. *
* *
* *
*******************************************************************************# hostname
wpar1
#bash-3.00# clogin wpar1 hostname
wpar1
Tired of playing with it? ’stopwpar’ will kill it.
bash-3.00# stopwpar
Usage: stopwpar [-F|-h] [-N|-t] [-r] [-v] wparName Flags:
-F = Forced stop.
-h = Hard stop.
-N = No timeout for halt.
-t = User specified halt timeout in seconds.
-r = Reboot after halt is completed.
-v = Verbose mode.
bash-3.00# stopwpar wpar1
Stopping workload partition wpar1.
Stopping workload partition subsystem cor_wpar1.
0513-044 The cor_wpar1 Subsystem was requested to stop.
stopwpar: 0960-261 Waiting up to 600 seconds for workload partition to halt.
Shutting down all workload partition processes.
Unmounting all workload partition file systems.
bash-3.00#
Also you might want to check out ‘chwpar’ for changing WPAR configurations.
bash-3.00# chwpar
Usage:
To change a setting:chwpar [-a] [-A] [-c] [-d directory] [-D attr=value ...] …
[-F] [-h hostName] [-n newName] [-N attr=value ...] …
[-P] [-R attr=value ...] [-S attr[+|-]=value …] [-u userScript] [-v]
wparNameTo delete a setting:
chwpar -K [-A] [-c] [-D devname=value] … [-F] [-N address=value] …
[-R [attr ...] ] [-S] [-u] [-v]
wparNameFlags:
-a = Automatically resolve erroneous/conflicting settings.
-A = Start automatically on system boot.
-c = Flag as checkpointable.
-d = Base directory.
-D = Device exports (devname, devtype, export).
-F = Force - ignore certain errors.
-h = Hostname.
-n = New workload partition name.
-N = Network settings (interface, address, netmask, broadcast).
-P = Set workload partition root password interactively.
-R = Resource control settings (active, rset, CPU, memory, procVirtMem,
shares_CPU, shares_memory, totalProcesses, totalThreads).
-S = Configures the security settings of a workload partition (secfile, privs[+|-]).
-u = User script to execute on start & stop.
-v = Verbose mode.
That’s a basic overview of creating a WPAR. Consult the man page for more complex configurations. This just demonstrates basic functionality.
