Informing the IBM Community

VIOS: How to create multiple virtual disks in a Shared Storage Pool


Abstract technology background with hexagonal shapes

I recently installed a Power8 system with VIOS and used this opportunity to configure a Shared Storage Pool (SSP) cluster. I needed to allocate around 34TB of storage space across 2 x IBM i LPARs which necessitated me creating 245 x 140GB virtual disks.

While the simple option is to use the HMC GUI to create the volumes, this would have taken me a very long time. Why is this?

When you use the HMC GUI to create and map virtual disks to an LPAR, it only allows you to create them one at a time. After each virtual disk is created the HMC executes an inventory check of the VIOS instances that make up the SSP cluster. This takes around 15-20 seconds for each virtual disk you create. I estimated it would have taken me around thee hours to create and map the volumes using the GUI.

Ideally, the HMC GUI would provide an interface similar to V7000 which allows you to specify a name for your disks, their size and then the quantity of disks you want to create. But we don’t have that yet.

SSP: a quick refresher

SSPs are similar to VMWare Datastores so your storage administrators will already be familiar with this approach.

Traditionally, we defined and created all the volumes for all our LPARs in the storage, e.g. V7000. If we need to create a new LPAR the we need to create the new volumes in the SAN and then define the SAN zoning on the SAN switches too.

With SSPs, we allocate a small number of large chunks of storage from the SAN to a VIOS SSP. For example, we might create 20 x 2TB volumes giving us a 40TB storage pool. VIOS SSP then consolidates these large volumes into a single storage space. We can then create the virtual disks from the consolidated storage space. Because the VIOS LPARs are clustered they can share the storage space.

The fast way to create multiple virtual disks

Using the VIOS CLI, I was able to create two scripts to speed up the create and map process.

The process is as follows:

VIOS1        Create volumes
VIOS1        Map volumes to LPAR
VIOS2        Map volumes to LPAR

You can see from above that I only create the volumes on VIOS1. When the volumes are created, all the other VIOS instances on the SSP cluster will become aware of the volumes too.

Create the virtual disks in the SSP

To create the virtual disks I need to run the VIOS lu -create command:

lu -create -clustername MYCLUSTER -sp MYPOOL -lu MYLPAR_L001  -size 140G

This command would create a single 140GB virtual disk called MYLPAR_L001 in the SSP.

What I needed to do was script this to allow me to create multiple virtual disks. Here’s the makessplu.ksh script I created:

# makessplu.ksh - Create a set of LUs in a storage pool
# Usage - makessplu start_lu_number end_lu_number lpar_name size_in_GB cluster_name storage_pool_name
# e.g. makessplu.ksh 1 185 mylpar 140 cl_mycluster sp_mypool
# Will create 185 LUs each 140GB and named mylpar_L001-L183 in storage pool sp_mypool which is in cluster cl_mycluster

typeset -Z3 x
while [[ i -le $2 ]]; do
      /usr/ios/cli/ioscli lu -create -clustername $cluster -sp $stgpool -lu $lu -size $size

By running the following command I can create 185 virtual disks in my SSP in no time at all:

./makessplu.ksh 1 185 mylpar 140 cl_mycluster sp_mypool

The comments at the top of the script describe how the script is used.

Mapping the virtual disks to the LPAR

The next part requires some thought. When we map virtual disks from an SSP we use vSCSI devices to link the VIOS and the client LPAR. With IBM i V7R1, which I was installing, there is a maximum of 16 devices per vSCSI adapter. So, 185 divided by 16 gives me 11.56 which means I need at least 12 vSCSI adapters to be able to attach my 185 virtual disks.

To map a virtual disk to a vSCSI adapter, we use the VIOS lu -map command:

lu -map -clustername MYCLUSTER -sp MYPOOL -lu MYLPAR_L001 -vadapter -vtd vhost0 MYLPAR_L001

This command will take the MYLPAR_L001 virtual disk created previously and map it to vSCSI adapter vhost0. It will also give the mapping a name of MYLPAR_L001. I keep the lu name and the mapping name the same to help with easier identification and troubleshooting.

My mapping script will map virtual disks to a single vhost so I needed to execute this 12 times, once per vhost.

# mapssplu.ksh - Map a set of SSP LUs to a vhost
# Usage - mapssplu start_lu_number end_lu_number lpar_name vhost_adapter cluster_name storage_pool_name
# e.g. mapssplu.ksh 1 16 mylpar vhost0 cl_mycluster sp_mypool
# Will map LUs mylpar_L001-L016 to vhost0 using LUs mylpar_L001-L016 which are in storage pool sp_mypool contained in cluster cl_mycluster
typeset -Z3 x
while [[ i -le $2 ]]; do
      /usr/ios/cli/ioscli lu -map -clustername $cluster -sp $stgpool -lu $lu -vadapter -vtd $vtd $lu

To map my 185 disks to my 12 vSCSI adapters, I ran:

./mapssplu.ksh 1 16 mylpar vhost0 cl_mycluster sp_mypool
./mapssplu.ksh 17 32 mylpar vhost1 cl_mycluster sp_mypool
./mapssplu.ksh 33 48 mylpar vhost2 cl_mycluster sp_mypool
./mapssplu.ksh 49 64 mylpar vhost3 cl_mycluster sp_mypool
./mapssplu.ksh 65 80 mylpar vhost4 cl_mycluster sp_mypool
./mapssplu.ksh 81 96 mylpar vhost5 cl_mycluster sp_mypool
./mapssplu.ksh 97 112 mylpar vhost6 cl_mycluster sp_mypool
./mapssplu.ksh 113 128 mylpar vhost7 cl_mycluster sp_mypool
./mapssplu.ksh 129 144 mylpar vhost8 cl_mycluster sp_mypool
./mapssplu.ksh 145 160 mylpar vhost9 cl_mycluster sp_mypool
./mapssplu.ksh 161 176 mylpar vhost10 cl_mycluster sp_mypool
./mapssplu.ksh 177 185 mylpar vhost11 cl_mycluster sp_mypool

I did this on VIOS1 first and then used copy and paste to run the same commands on VIOS2. Instead of taking me around thee hours, the whole process took less than 15 minutes.

A handy tip: When you’ve executed a number of commands on one VIOS and you then want to copy and paste these to another VIOS, try this:

history| awk ‘{$1=””; print $0}’

This will list out the most recent commands from the history log for your session so you can simply copy and paste them.

While I agree the mapping part is a little clunky, the scripts saved me over three hours of work and dramatically reduced naming and mapping errors I may have made.

The scripts can be located on my IBM Developerworks Wiki at

Glenn Robinson has been PowerWire‘s resident tech tipster for over a decade. He has worked in the IBM computing arena since 1986 on System/34/36/38 and AS/400 through to Power Systems today.

As systems architect for IBM systems and storage at RSI Consulting, based in Northampton, UK, he works predominantly with IBM i clients as well as those using AIX and Linux. In the last five years, he has also had a great deal if experience working with Power customers using SVC and V7000 storage virtualisation.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.