AIX Workload partition
id : 2kn88psmm4
category : computer
blog : unix
created : 09/14/11 - 15:57:26

wpar creation :
  • To create a wpar use mkwpar command :
#mkwpar -g wparvg -h infviomon1 -l -n infviomon1 -N interface=en5 address=10.246.70.52 netmask=255.255.255.0 -P -r -s -o /root/infviomon1.config

    • -g : wpar logical volumes will be create on wparvg.
    • -h : hostname will be infviomon1.
    • -l : wpar will have its own /usr and its own /opt.
    • -n : wpar name will be infviomon1.
    • -N : network settings :
      • interface : used interface on hosting system will be en5.
      • address : wpar ip address will be 10.246.70.52.
      • netmask : wpar netmask will be 255.255.255.0.
    • -P : password will be interactively asked at wpar creation.
    • -r : copy /etc/resolv.conf on wpar.
    • -s : start wpar after creation.
    • -o : wpar specification file will be /root/infviomon1.config

wpar common administration :
  • To list all wpars running on system use lswpar command :
#lswpar
Name        State  Type  Hostname    Directory          RootVG WPAR
--------------------------------------------------------------------
infviomon1  A      S     infviomon1  /wpars/infviomon1  no

  • State :
    • D : defined.
    • L : loaded.
    • A : active.
    • F : frozen.
    • P : paused.
    • M : moving.
    • T : transitional.
    • B : broken.
    • E : error.
  • Type :
    • A : application wpar. (application workload partitions provide an environment for isolation of applications and their resources to enable checkpoint, restart, and relocation at the application level. Application WPARs do not require their own instance of system services.)
    • S : system wpar. (autonomous virtual system with their own private file systems, users and groups, login, network ...)
  • RootVG Wpar :
    • yes : wpar has its own rootvg on a dedicaced storage devices. (use -O at creation to create a rootvg wpar)
    • no : rootvg is on an logical volume.
  • To start a wpar use startwpar command :
#startwpar -v infviomon1
Starting workload partition 'infviomon1'.
Mounting all workload partition file systems.
Mounting '/wpars/infviomon1'.
Mounting '/wpars/infviomon1/app/list/data'.
Mounting '/wpars/infviomon1/home'.
Mounting '/wpars/infviomon1/opt'.
Mounting '/wpars/infviomon1/proc'.
Mounting '/wpars/infviomon1/tmp'.
Mounting '/wpars/infviomon1/usr'.
Mounting '/wpars/infviomon1/var'.
Loading workload partition.
Exporting workload partition devices.
Exporting workload partition kernel extensions.
Starting workload partition subsystem 'cor_infviomon1'.
0513-059 The cor_infviomon1 Subsystem has been started. Subsystem PID is 9437322.
Verifying workload partition startup.
Return Status = SUCCESS.

  • To stop a wpar use stopwpar command :
#stopwpar -v infviomon1
Stopping workload partition 'infviomon1'.
Stopping workload partition subsystem 'cor_infviomon1'.
0513-044 The cor_infviomon1 Subsystem was requested to stop.
stopwpar: 0960-261 Waiting up to 600 seconds for workload partition to halt.
Shutting down all workload partition processes.
WPAR='infviomon1' CID=1
ID=2097153 KEY=0x4107001c UID=0 GID=9 RT=-1
ID=11534352 KEY=0x010111e0 UID=0 GID=0 RT=-1
ID=9437201 KEY=0xffffffff UID=0 GID=0 RT=-1
ID=15728659 KEY=0xffffffff UID=0 GID=0 RT=-1
wio0 Defined
Unmounting all workload partition file systems.
Umounting '/wpars/infviomon1/var'.
Umounting '/wpars/infviomon1/usr'.
Umounting '/wpars/infviomon1/tmp'.
Umounting '/wpars/infviomon1/proc'.
Umounting '/wpars/infviomon1/opt'.
Umounting '/wpars/infviomon1/home'.
Umounting '/wpars/infviomon1/app/list/data'.
Umounting '/wpars/infviomon1'.
Return Status = SUCCESS.

wpar backup :
  • To backup a wpar use savewpar command !
#savewpar -Nif /mnt3/infviomon1/infviomon1.backup infviomon1

Creating information file (/image.data) for infviomon1.

Creating list of files to back up

Backing up 52714 files.........

52714 of 52714 files backed up (100%)
0512-038 savewpar: Backup Completed Successfully.

  • On exemple /mnt is mounted with nfs.
wpar restore :
  • To restore a wpar use restwpar command :
  • If you restore a wpar on another system, check hdisk number used by vg, and network interface name :
    • if network interface name change : get your wpar configuration file and change interface :
# vi /mnt/infviomon1.conf
[..]
interface = "en0"
[..] 

    • if destination hdisk change :
      • restore image.data
# restore -Tqvf ./infviomon1.backup | grep image.data
New volume on ./infviomon1.backup:
 Cluster 51200 bytes (100 blocks).
    Volume number 1
    Date of backup: Wed Sep 14 15:44:55 2011
    Files backed up by name
    User root
        7932 ./.savewpar_dir/image.data
# restore -xqvdf ./infviomon1.backup ./.savewpar_dir/image.data
New volume on ./infviomon1.backup:
 Cluster 51200 bytes (100 blocks).
    Volume number 1
    Date of backup: Wed Sep 14 15:44:55 2011
    Files backed up by name
    User root
x         7932 ./.savewpar_dir/image.data
    total size: 7932
    files restored: 1

      • replace all occurence of old hdisk with new hdisk :
# sed 's/hdisk4/hdisk10/g' .savewpar_dir/image.data > newimage.data

  • And restore .....
# restwpar -n infviomon1 -h infviomon1 -d /wpars/infviomon1 -f /mnt/infviomon1.backup -w /mnt/infviomon1.config -i /mnt/newimage.data

  • You can start wpar after restoration.

Commands from global system
  • You can run commands from hosting system :
    • ps :
# ps -ef -@ infvimon1
       WPAR      UID      PID     PPID   C    STIME    TTY  TIME CMD
 infviomon1        0  7209028  9830498   0 16:29:55      -  0:00 /bin/bsh /etc/rc.tcpip
 infviomon1        0  9699368  9830498   0 16:29:55      -  0:00 /usr/sbin/srcmstr
 infviomon1        0  9830498  3080348   1 16:29:53      -  0:00 /etc/init
 infviomon1        0 11337860  9830498   0 16:29:55      -  0:00 /usr/lib/errdemon
 infviomon1        0 17039360  7209028   0 16:29:57      -  0:00 sleep 1

    • top :
# topas -@ infviomon1