Introduction
IBM Power Virtual Server (PowerVS) uses storage tiers to allow users to choose the disk IO speed for their volumes. The storage tier of volumes can be changed while the LPAR (VSI) is running. This allows users the ability to increase their disk speed to shorten the runtime of disk intensive tasks like adding disks to IBM i storage pools, system saves, or other disk intensive jobs. The disk speed can be increased during these tasks and then changed to a slower speed during regular operation to avoid paying for the fast tier all the time.
The storage tier of a volume can be changed in the cloud portal, but this is an onerous task if the LPAR has many volumes.
Scripted storage tier change
Using the IBM Cloud CLI and some scripting we can quickly change the storage tier of all the volumes attached to an LPAR. This can be wrapped into a utility script that takes the instance name and desired storage tier as inputs like this:
changeVSIVolumeTier.sh [-h] [-i INSTANCE NAME] [-t STORAGE TIER]
Changes the storage tier on all the volumes of a PowerVS instance.
h print help
i instance name or ID
t storage tier value as shown by "ibmcloud pi storage-tiers"
The full script can be found at the end of this article.
Running the script
The script requires the IBM Cloud CLI and the jq command. While it can be run from a local terminal window, it can also be run in a web browser within the IBM Cloud Shell which provides both the IBM Cloud CLI and jq.
Before running the script, target the PowerVS workspace containing the LPAR by first listing the workspaces and then target the workspace using its CRN.
List workspaces:
$ ibmcloud pi workspace list
Listing workspaces under account My Account as user myemail@ibm.com...
CRN ID Name
crn:v1:bluemix:public:power-iaas:dal10:a/cdefe7e148df3132cda4b6899c5ca532:24578261-535a-45d4-adfc-9251e2af021c:: 24578261-535a-45d4-adfc-9251e2af021c my-workspace
Target workspace:
$ ibmcloud pi workspace target crn:v1:bluemix:public:power-iaas:dal10:a/cdefe7e148df3132cda4b6899c5ca532:24578261-535a-45d4-adfc-9251e2af021c::
Targeting service crn:v1:bluemix:public:power-iaas:dal10:a/cdefe7e148df3132cda4b6899c5ca532:24578261-535a-45d4-adfc-9251e2af021c::...
Once the workspace is targeted the script can be used to change volume tiers. Here is an example of changing all the volumes on an LPAR named “testinstance” to tier 0:
$ ./changeVSIVolumeTier.sh -i testinstance -t tier0
Retrieving VSI volume list
Changing tier of volume e36f70c0-b394-4fa9-9ba0-cb195bc6429c
Performing action on volume e36f70c0-b394-4fa9-9ba0-cb195bc6429c under account My Account as user myemail@ibm.com ...
OK
Action complete for Volume ID e36f70c0-b394-4fa9-9ba0-cb195bc6429c.
Changing tier of volume ae36b0b9-782c-4257-a74d-8dcf4d3e0de1
Performing action on volume ae36b0b9-782c-4257-a74d-8dcf4d3e0de1 under account My Account as user myemail@ibm.com...
OK
Action complete for Volume ID ae36b0b9-782c-4257-a74d-8dcf4d3e0de1.
Script source
Here is the changeVSIVolumeTier.sh script. It can be saved as a file locally, uploaded to Cloud Shell, or created in Cloud Shell using a text editor like “vi”.
#!/usr/bin/env bash
# Copyright 2025 IBM
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
usage() {
# Display Help
cat <<EOF
Syntax: $ changeVSIVolumeTier.sh [-h] [-i INSTANCE NAME] [-t STORAGE TIER]
Changes the storage tier on all the volumes of a PowerVS instance.
h print help
i instance name or ID
t storage tier value as shown by "ibmcloud pi storage-tiers"
EOF
}
fatal() {
echo "FATAL: $*"
exit 1
}
while getopts ":hi:t:" opt; do
# for each argument present assign the correct value to override the default value
# values defined after the flag are stored in $OPTARG
case $opt in
h) # if -h print usage
usage
exit 0
;;
i) vsi_name=$OPTARG ;;
t) tier=$OPTARG ;;
\?) # this case is for when an unknown argument is passed (e.g. -c)
echo "Invalid option: -$OPTARG"
exit 1
;;
esac
done
[[ -z "$vsi_name" ]] && fatal "The VSI name or ID is required"
[[ -z "$tier" ]] && fatal "The storage tier is required"
# Validate the provided tier is available
tiers=`ibmcloud pi storage-tiers --json | jq -r '.[] | .name'`
avail=false
for t in $tiers
do
if [ $t == $tier ]; then
avail=true
break
fi
done
if [ $avail == false ]; then
fatal "The storage tier \"$tier\" is not available. Check the available values in the command \"ibmcloud pi storage-tiers\"."
fi
echo "Retrieving VSI volume list"
vols=`ibmcloud pi ins get $vsi_name --json | jq -r .volumeIDs[]`
for vol in $vols
do
echo "Changing tier of volume $vol"
ibmcloud pi volume action $vol --target-tier $tier
done