Allocating a device

The allocation process consists of providing a storage device that can be used by the WPAR.

A device can be allocated to a WPAR when the WPAR is created or it can be added to WPAR in a later operation. For a device to be allocated to a WPAR, it must be in the available state or the defined state in the global environment.

To query the device state, run the following command:
lsdev -l <device>
A device can be allocated to more than one WPAR, but can be used only by one WPAR at a time. To allocate a device while creating the WPAR, run the following command:
mkwpar -D devname=<device name> -n <wpar name>
For a rootvg WPAR, the device to hold the rootvg must be specified, as in the following example:
mkwpar -D devname=<device name> rootvg=yes -n <wpar name> 
The -D parameter can be repeated to specify multiple storage devices. The devid attribute can be used if the unique device identifier for the storage device is known. The devid and devname attributes cannot be specified together.
mkwpar -D devid=<unique device id> -n <wpar name> 
To allocate a device to an existing WPAR, run the following command:
chwpar -D devname=<device name> <wpar name>
Additional disks can be allocated to a WPARs root volume group with the following command:
chwpar -D devname=<device name> rootvg=yes <wpar name> 

When you allocate a storage device to an active WPAR, the device is exported to the WPAR unless it was previously exported. To import the newly allocated device into the WPAR, invoke the cfgmgr command within the WPAR.

A storage device can be allocated to more than one WPAR. However, the device can be exported to only one WPAR at a time. The device is exported to the WPAR that starts first. After a device is exported to a WPAR, the extended state of the device is listed as Exported. To see the extended state of a device, run the following lsdev command with the new -x flag:
lsdev -x -l hdisk1
A message similar to the following example is displayed:
hdisk1 Exported 01-08-02 MPIO Other DS4K Array Disk

Deallocating a device

To deallocate a storage device from an existing WPAR, run the following command from the global environment:
chwpar -K -D devname=<device name> <wpar name>

When a storage device is deallocated from an inactive WPAR, the device is removed from the WPAR configuration. When a storage device is deallocated from an active WPAR, the chwpar command attempts to unconfigure the device. If the device is used, the unconfiguration operation fails and the command to remove the device from the WPAR also fails. When the command is successful, the device in the WPAR changes from the available state to the defined state.