Friday, December 21, 2012

AIX WPAR Configuration and Administration


AIX WPAR Configuration and Administration


IBM introduced work load partitions (WPAR) in AIX from v6.1. WAPR enables virtuvalization features in Logical partition i.e nothing but LPAR.

The main difference between LPAR and WPAR is, every LPAR required its own Operating system and certain amount hardware resources like CPU, memory ,disks ... 

whereas WPAR is independent of all these.

Advantage of WPAR:
  1. AIX admin can create a WPAR through a single command  or SMIT menu within 30 Minutes (quick deployment).
  2. You can create individual WPAR for each of your application.
  3. WPAR is independent of your rootvg and you can maintain individual environment for each WPAR (like file systems, configurations, users, network, tuning settings..etc).
  4. You can maintain WPAR image for each of your environment like Prod/Test/Dev/Non-prod/Lab. 

Disadvantage of WPAR:
  1. If any hardware/Network failures at LPAR level it will affect all WPAR’s on that box.
  2. WPAR is not capable of high load / high I/O applications and data bases.
  3. WPAR is not recommended for Production environment so far..
  4. WPAR is not recommended for highly security environments.
  5. No Support for physical devices on WAPR point (You can’t add storage..etc).

WPAR’s categorized as two types:
  1. System Workload Partition: This type of WPAR’s is much closer to complete version of AIX. The system WPAR has its own dedicated, completely writable file systems along with its own inetd and cron.
  2. Application Workload Partitions: Application WPARs are real, lightweight versions of virtualized OS environments. They are extremely limited and can only run application processes, not system daemons such as inetd or cron. One cannot even define remote access to this environment.

WPAR Administration:
Here I will be creating a System wpar named testwpar that is independent of my LPAR rootvg.

To accommodate this request I will create a separate VG named wparvg for all my WPAR's and under that VG I will create base file system (/wpar) for my testwpar.

1. Create wparvg on hdisk0
subha:/ # mkvg -B -s 128M -y wparvg hdisk0
wparvg
subha:/ #

2. Create a base File system for testwpar install.
subha:/ #  crfs -v jfs2 -g wparvg -a size=20G -m /wpar
File system created successfully.
20970676 kilobytes total disk space.
New File System size is 41943040

subha:/ #
subha:/ # mount /wpar

3. Change FS permissions to 700 for security
subha:/ # chmod -R 700 /wpar

4. Create a system wpar named testwpar with IP 10.x.x.x under wparvg and base file system is /wpar/testwpar …

-A for to add WPAR info to /etc/rc.wpars and add to global /etc/inittab to start wpar at LPAR Boot.
-s to start WPAR after creation (Here I havn’t user –s, I will start WPAR with startwpar command).

subha:/ # mkwpar -A -n testwpar -N address=10.x.x.x -g wparvg -d /wpar/testwpar
mkwpar: Creating file systems...
 /
 /home
 /opt
 /proc
 /tmp
 /usr
 /var

subha:/ # lswpar
Name      State  Type  Hostname  Directory       RootVG WPAR
-------------------------------------------------------------
testwpar  D      S     testwpar  /wpar/testwpar  no
subha:/ #

To Start WPAR with #startwpar

subha:/ # startwpar testwpar
Starting workload partition 'testwpar'.
Mounting all workload partition file systems.
Loading workload partition.
Exporting workload partition devices.
Starting workload partition subsystem 'cor_testwpar'.
0513-059 The cor_testwpar Subsystem has been started. Subsystem PID is 14024940.
Verifying workload partition startup.

To login to WPAR use command #clogin
subha:/ # clogin testwpar
*******************************************************************************
*  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
testwpar
#

To list all WPAR’s running on given LPAR #lswpar
Use –L option for WPAR detailed information including all configurations.

To get WPAR resource limit usage you can use below command
subha:/ # lswpar -a Name,State,Hostname,CPU,memory,Shares_CPU,Shares_memory
Name      State  Hostname  CPU Limits    Memory Limits  CPU Shares  Memory Shares
----------------------------------------------------------------------------------
testwpar  A      testwpar  0%-100%,100%  0%-100%,100%   unlimited   unlimited
subha:/ #

To change CPU & Memory allocations to WPAR use #chwpar
subha:/ # chwpar -R CPU=5%-40%,60% testwpar
subha:/ # chwpar -R memory=10%-30%,40% testwpar
subha:/ #
subha:/ # lswpar -a Name,State,Hostname,CPU,memory,Shares_CPU,Shares_memory
Name      State  Hostname  CPU Limits  Memory Limits  CPU Shares  Memory Shares
--------------------------------------------------------------------------------
testwpar  A      testwpar  5%-40%,60%  10%-30%,40%    unlimited   unlimited
subha:/ # lswpar
Name      State  Type  Hostname  Directory    RootVG WPAR
----------------------------------------------------------
testwpar  A      S     testwpar  /wpar/wpars  no
subha:/ #

Here State –A (Active), type –S (System WPAR), Hostname =WPAR Name, Directory=WPAR Base FS, Rootvg=no (Independent of LPAR rootvg).

To stop running WAPR #stopwpar
subha:/ # stopwpar testwpar
Stopping workload partition 'testwpar'.
Stopping workload partition subsystem 'cor_testwpar'.
0513-044 The cor_testwpar Subsystem was requested to stop.
stopwpar: 0960-261 Waiting up to 600 seconds for workload partition to halt.
Shutting down all workload partition processes.
wio0 Defined
Unmounting all workload partition file systems.

Here you can see State of WPAR is D – Deactivated.

subha:/ # lswpar
Name      State  Type  Hostname  Directory    RootVG WPAR
----------------------------------------------------------
testwpar  D      S     testwpar  /wpar/wpars  no
subha:/ #

To remove WPAR including its local file systems #rmwpar
If you don’t want remove FS’s use –p and –s options.

subha:/ # rmwpar testwpar
rmwpar: Removing file system /wpar/wpars/var.
rmlv: Logical volume fslv07 is removed.
rmwpar: Removing file system /wpar/wpars/usr.
rmwpar: Removing file system /wpar/wpars/tmp.
rmlv: Logical volume fslv06 is removed.
rmwpar: Removing file system /wpar/wpars/proc.
rmwpar: Removing file system /wpar/wpars/opt.
rmwpar: Removing file system /wpar/wpars/home.
rmlv: Logical volume fslv05 is removed.
rmwpar: Removing file system /wpar/wpars.
rmlv: Logical volume fslv04 is removed.
subha:/ #

subha:/ # lswpar --------------------------------------------No WPARS.
subha:/ #

Will Be adding more on WPAR Soon until then keep rocking with AIX :) (:



Saturday, November 3, 2012

VIOS Intall Through Command Line

VIOS Installing This is ref doc will give basic idea to install VIOS on VIO Lpar created from HMC Menu. We can Install VIOS three ways .. 1.Install directly from Media (CD/DVD) 2.Install from the HMC Command line (installios) 3.Install from NIM master. Note: To migrate VIOs from v1.x to v2.x we need to use Migration DVD that will be supplied from IBM. 1.Install directly from Media (CD/DVD): To use this procedure , we Need to place VIOS media in system drive and make sure that DVD drive slot is available for VIOS partition. (we need to define SAS non-Raid Adapter as required adapter for VIO Lpar). Activate the partition, when starting the partition, select the checkbox to open a terminal window --> Click Advanced button and replace the default mode with selection of Diagnostic with Default bootlist. This makes us to boot from the DVD device. Note: Once the installation is complete the VIO partition will reboot automatically. ***********************************************************************************************************************xxxxxxx********************************************************************************************************************** 2.Install from the HMC Command line (installios): The below procedure will useful for Installing the VIOS from HMC menu. 1.Place the VIOS DVD media in HMC DVD drive (VIO lapr should be part of that HMC) 2.Run installios as a hscroot with SSH connection. This command will prompt required details to install IOS. hscroot@XXXXXXX:~> installios The following objects of type "managed system" were found. Please select one: 1. AXXXXXA 2. AXXXXXB 3. AXXXXXC 4. AXXXXXD 5. AXXXXXE 6. AXXXXXF 7. AXXXXXG 8. AXXXXXH Enter a number (1-8): 5 The following objects of type "virtual I/O server partition" were found. Please select one: 1. violabdal1a 2. violabdal1b 3. viotesta Enter a number (1-3): 3 The following objects of type "profile" were found. Please select one: 1. Normal Enter a number: 1 Enter the source of the installation images [/dev/cdrom]: Note: We need to configure few parameters a. network (VIOS IP,Subnet mask, gateway) b. Ethernet settings (Speed and Duplex) c. if you’re willing to configure client network. Note: Once the installation is complete the VIO partition will reboot automatically. ****************************************************xxxxxxx************************************************** 3.Install from NIM master: Installing the VIOS from NIM is similar to installing VIOS from the HMC (both mechanism will use network boot method). We have option installios from NIM master as like HMC. Here creating of NIM object s to corresponding resources and client (The VIOS) is done automatically. ***********************************************************************************************************************xxxxxxx********************************************************************************************************************** Configuring VIOS after Installation: 1.After installation login to the VIOS as padmin (not root). This will be prompted to set the password. 2.When we are doing first time installation we Need to accept software maintenance terms. This will provide three options as shown below Accept (a) | decline (d) | View terms (v) ----- > Enter A to accept license. 3.Accept the license agreement by using follow command $ license -accept (If we forgot issue at first time install, The VIOS won't allow next login) 4.To make any configuration changes use cfgassist (we can change time zone, password Set, Security, VIOS TCP/IP settings, Install/update software.Storage,Performance ....) ***********************************************************************************************************************xxxxxxx********************************************************************************************************************** VIOS Command Line interface: VIOS command line interface is restricted Kron shell and some of the basic operations will not be available. 1.Limited Set of commands available. 2.we cannot change directory or set SHELL,ENV or PATH 3.No I/O redirection (>,>>,<,<<) $ pwd /home/padmin $ cd /tmp rksh: cd: restricted $ ioslevel >> /tmp/ioslevel.subha.out rksh: /tmp/ioslevel.subha.out: restricted