Monday, December 31, 2007

Creating a WPAR in AIX 6.1

You can create a WPAR in may ways:

Command mkwpar
AIX Smitty interface - the ever popular curses based AIX system admin tool
The new pconsole a replacement for the older WebSM
WPAR Manager GUI
Below we are going to use the command line because it is simple and straightforward.
If you use one of the other tools you have to support all the same information but it takes longer to type it all in and you can't cut'n'paste the next WPAR that you want to create. The command line is quite simple but there are options here too depending on what you want of your WPAR.

1 - Make the simplest possible WPAR
To make a simple WPAR with its file systems on the global AIX disks, just type the following:

mkwpar -n myfirstwparAll we have supplied is a WPAR name and this WPAR is not even on the network. We have to use a special command (clogin) to gain access to the WPAR from the global area. while very secure this is not very useful but shows that all the defaults can be taken. This mkwpar command takes a few minutes and does the following:

Creates the filesystems for the WPAR
Mounts the filesystems
copies over some files from the global AIX
Performance an install of AIX packages (much like what we see while installing AIX) to create the files in the WPAR private filesystems (/, /var, /home and /tmp) we don't need to rebuild the read-only filesystems).
The WPAR is prepared and made ready to run.
This takes about 3 to 4 minutes on my System p p550Q where my global LPAR is a Virtual I/O Server (VIOS) client so the disks are virtualized and actually on the VIOS. It also seems to be roughly the same regardless of local disk or NFS filesystems.

2 - Make local disk WPAR with a network.
We might as well put the WPAR straight on the network to save time. Simply add the -N options as you might expect. You will need to have a IP address and hostname allocated. We also need to supply the hostname with the -h option. Note: I name the WPAR after the hostname (i.e. wp13) - this makes life simpler but its not mandatory. Finally, the -r option means use the DNS setting of the global AIX for the WPAR - this saves time. In this example, we have assumed the global AIX is on just the one default network. If there was more than one we would need to specify which. We will explore how the WPAR gets network access later on.

mkwpar -n wp13 -h wp13 -N netmask= address= -rNote: Of course, replace the network IP addresses to suite your network - I just made these number up.

3 - Make NFS disk WPAR with a network - ready for Mobility/Relocation
If we want to move the WPAR between global AIX copies i.e. between LPARs or machines then we need to NFS mount the WPAR private filesystems. Assuming here that we have the NFS running and have made the NFS mount points available to this global AIX and to the WPAR hostnames (in this example wp13) then we use the following command.

mkwpar \
-n wp13 \
-h wp13 \
-N netmask= address= \
-r \
-c \
-M directory=/ vfs=nfs dev=/scratch/wp13root \
-M directory=/home vfs=nfs dev=/scratch/wp13home \
-M directory=/tmp vfs=nfs dev=/scratch/wp13tmp \
-M directory=/var vfs=nfs dev=/scratch/wp13varNote the extra options in this command:

-c means this WPAR is "checkpointable" which is used to in Live Application Mobility = Relocate to a different AIX.
-M there is one of these for each of the four private filesystems for the WPAR. Hopefully, it is clear in the example that we have the filesystem name (directory=), the connection(vfs=nfs) and there may be other ways of supporting the file system in the future, and the hostname and mount point of the NFS server.
This gives you a fully functioning relocatable WPAR and is the command I use to create new WPARs. I simply take an existing script containing this command and edit it to suit the next WPAR. You could make a more generic single script if you have time and things like the mount points are similar for each WPAR.

4 - As above but via a Spec File
An alternative way to create a WPAR is using a "spec file" which includes the options you want. The option you specify on the command like will over ride the file contents. You can ask the mkwpar command to save a spec file with the -o option the first time you run it or you can find the master copies in the /wpars directory. You can take a spec file of a current WPAR and change it for WPAR specific details and use that to create a new WPAR.

mkwpar -f my.specthe spec file looks like the one below:

name = "wp13"
preserve = "no"
hostname = "wp13"
checkpointable = "yes"
directory = "/wpars/wp13"
privateusr = "no"
devices = "/etc/wpars/devexports"

broadcast = ""
interface = "en0"
netmask = ""
address = ""

dev = "/scratch/wp13root"
mountopts = "bg,intr"
directory = "/"
vfs = "nfs"
host = ""

dev = "/scratch/wp13home"
mountopts = "bg,intr"
directory = "/home"
vfs = "nfs"
host = ""

dev = "/scratch/wp13tmp"
mountopts = "bg,intr"
directory = "/tmp"
vfs = "nfs"
host = ""

dev = "/scratch/wp13var"
mountopts = "bg,intr"
directory = "/var"
vfs = "nfs"
host = ""

dev = "/usr"
directory = "/usr"
vfs = "namefs"
mountopts = "ro"

dev = "/proc"
directory = "/proc"
vfs = "namefs"
mountopts = "rw"

dev = "/opt"
directory = "/opt"
vfs = "namefs"
mountopts = "ro"

secfile = "/etc/wpars/secattrs"5 - Creating with smitty
The "smitty wpar" command will take you to the smitty panels to control and create a WPAR.
If you have understood the above information requirements you should have no problem at all using smitty but I find filling in all the NFS mount points etc. a little tedious.

6 - Creating with WPAR Manager
The WPAR Manager allows two ways to create a WPAR:

The full Guided Activity - Create Workload Partition (take the link on the left had sidebar) which will take you through a series of panels for the various aspects of the WPAR and then create a WPAR for you
The simple quick Resource Views - Workload Partitions (the panel which shows the WPARs) and click on "New". this asks the bare minimum of info and creates a WPAR to which you can later add.
We will look at WPAR Manager further down this article.

No comments: