IBM Support

How to add disk space to a running virtual machine on a PureApplication System W1700

Technical Blog Post


Abstract

How to add disk space to a running virtual machine on a PureApplication System W1700

Body

 

Have you been trying to figure out how to add disk space to a running virtual machine on a PureApplication System W1700? Maybe you've been hitting disk space errors when attempting to create new deployment instances and the Event critical error shows:

The file system {0} is running low on disk space. It has {1}MB remaining. Free some disk space to prevent the management server from crashing.

Insufficient disk space on datastore ''...

 

To add storage volumes to existing virtual machines, see the following best practice instructions for assistance with this procedure:

1. Add Storage Volume.
Select System Console -> Cloud -> Storage Volumes
Click the green plus sign () to Add a new Storage Volume to the appropriate cloud group.

example:

image

 

2. Attach new Storage Volume.
Select Workload Console -> Instances -> Virtual Machines
Select the virtual machine where you need the additional storage. 
Below Operating system volumes is a section labeled Storage volumes. Use the drop-down menu to select the storage volume you added in Step 1.

image

 

3. Find the new Storage Volume.
Log into the virtual machine as root or a user who can execute file system commands with root privilege.

List all available physical volumes. Note the ones you currently have.
lspv

So the new physical volume is seen
cfgmgr

List all available physical volumes again. The new one is the storage volume you attached in (Step 2):
lspv

The new one will be something like "hdisk1"

image

 

4. Extend a volume group to include the new physical volume
extendvg rootvg hdisk1

Note: For larger storage volumes (e.g. 100GB+), extendvg of the volume group to include
the new physical volume may fail with a warning message.

example:
extendvg: Warning, The Physical Partition Size of 64 requires the creation of 3200 partitions for hdisk1.  The limitation for volume group rootvg is 2032 physical partitions per physical volume.  Use chvg command with -t option to attempt to change the maximum Physical Partitions per Physical volume for this volume group.

The following sample script can be used to calculate and increase the maximum Physical Partitions (PP)
per Physical Volume (hdisk1) for the volume group (rootvg).

<------------begin script details------------>

#!/bin/sh

We first calculate the number of PPS available in all the rootvg hdisks

CURRENT_ROOTVG_HDISKS=$(lspv | grep rootvg | awk '{print $1}')
CURRENT_AVAILABLE_PPS=0
for hdisk in ${CURRENT_ROOTVG_HDISKS}; do
HDISK_AVAILABLE_PPS=$(lspv ${hdisk} | grep "TOTAL PPs:" | awk '{print $3}')
((CURRENT_AVAILABLE_PPS=${HDISK_AVAILABLE_PPS}+${CURRENT_AVAILABLE_PPS}))
done


Assuming that the disk we want to add to rootvg is hdisk1, lets get the size of the disk (in GB)

NEW_HDISK_SIZE=$(bootinfo -s hdisk1)

Let's calculate the sizes of the physical partitions we currently have allocated on the disk

PP_SIZE=$(lsvg rootvg | grep "PP SIZE" | awk '{print $6}')

Next, we calculate how many PPS we would have available between the current and new disk

((NEW_AVAILABLE_PPS=${NEW_HDISK_SIZE}/${PP_SIZE}+${CURRENT_AVAILABLE_PPS}))
((TOTAL_AVAILABLE_PPS=${CURRENT_AVAILABLE_PPS}+${NEW_AVAILABLE_PPS}))


We now calculate the max number of PPs we can have on the rootvg volume group

MAXPPPERVG=$(lsvg rootvg|grep "MAX PPs per PV:"|awk '{print $5}')

if MAXPPPERVG < TOTAL_AVAILABLE_PPS, we need to increase the number of PPs per VG for rootvg

if [[ ${MAXPPPERVG} -lt ${TOTAL_AVAILABLE_PPS} ]]; then
((NEW_PPS_PER_VG = ${TOTAL_AVAILABLE_PPS} / 1016 + 1))
chvg -t ${NEW_PPS_PER_VG} rootvg
fi


<------------end script details------------>

After executing the script (comments removed), you should be able to run the extendvg rootvg hdisk1 successfully.

To confirm physical volume is now in volume group
lspv

image

 

5. Increase the size of the filesystem(s) to utilize the newly added storage volume.

List all logical volumes in the volume group. Note the existing size of each filesystem
lsvg -l rootvg

Add the additional storage to each filesystem as needed
chfs -a size=<new size> <fs> 

example:
chfs -a size=+2G /opt

image

 

Note: to decrease the size of a filesystem, use the "-" sign instead of the "+" sign

example:
chfs -a size=-2G /opt

 

 

title image (modified) credit: (cc) Some rights reserved by damyon

 

Disclaimer

"THE SAMPLES ARE PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT OF PATENTS, COPYRIGHTS OR OTHER PROPRIETARY RIGHTS OF OTHERS. NEITHER THE AUTHOR NOR IBM WARRANT THAT THE FUNCTIONS, ROUTINES, AND DATA CONTAINED IN, OR GENERATED AS A RESULT OF THE SAMPLES, WILL MEET YOUR REQUIREMENTS OR BE ERROR-FREE. The entire risk related to the quality and performance of the Samples is with you. In the event that there is any defect, you assume the entire cost of all necessary services, repair or correction. IN NO EVENT WILL THE AUTHOR OR IBM BE LIABLE TO YOU OR TO ANY THIRD PARTY FOR ANY DIRECT OR INDIRECT DAMAGES (INCLUDING, WITHOUT LIMITATION, LOST PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES) ARISING OUT OF THE USE OR INABILITY TO USE THE SAMPLES, EVEN IF THE AUTHOR OR IBM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Some jurisdictions do not allow the exclusion of implied warranties or the limitation or exclusion of liability for incidental or consequential damages, so some of the above may not apply to you."
 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11081245