1. Home
  2. System Administration
  3. How to Increase Disk Space in Variphy Insight Virtual Appliance

How to Increase Disk Space in Variphy Insight Virtual Appliance

Overview

partresize.sh is a script that provides a quick, mostly-automated way to resize the Logical Volume Management (LVM) -managed storage on a deployed Variphy Insight Virtual Appliance (VIVA). This script is available in the /opt/variphy/scripts directory of the deployed appliance, and it is ready to use after first extending the virtual machine’s storage capacity through your virtual machine management software (vSphere, etc.).

This script is made available through the GNU General Public License v2-licensed project: github.com/alpacacode/Homebrewn-Scripts. Note that full license and source code are publicly available in the previous links.

*NOTE – In order for partresize.sh to run successfully the server will need to have ~100 MB free on the volume you are running the script against. The disk must not be completely full, otherwise the script will not have enough room and end up expanding a partition that does not exist. As a result the server will fail to connect to lvmetad therefor not being able to connect to the root file system and boots into (initramfs) which basically renders the server useless.

Caution

Per script comments, please take precaution and back-up the virtual appliance’s boot sector.


# The script will first resize the partition by changing the partition end sector of the selected partition, and then after a reboot resize the filesystem.
# By default it rescans the SCSI bus to check a change in disk size if the disk was hot-extended, which is easy with VMs, and only then proceeds.
# If the extended disk size is recognized by the OS already, you can force resizing with the -f flag.
# It is highly recommended you backup the boot sector of your disk as a safety measure with something like:
sudo dd if=/dev/sda of=sda_mbr_backup.mbr bs=512 count=1
sudo sfdisk -d /dev/sda > sda_mbr_backup.bak
# You can restore the partition table then like this:
# dd if=sda_mbr_backup.mbr of=/dev/sda bs=512 count=1
# sfdisk /dev/sda < sda_mbr_backup.bak –force” 1>&2

Volume Expand Procedure

You can expand the size of the VMDK disk while the virtual machine is online. However, you must reboot the guest operating system (OS) in the virtual machine so that it is aware of the size change of the VMDK disk.

Also, ensure that the virtual machine is not running on snapshots, as this prevents the VMDK from being extended.

In this example, we can see that the Physical Volume is 59.52GB, whereas the Logical Volume is 55.51GB (~59GB storage with 4GB subtracted for swap):

  • Determine Physical Volume details by running: sudo pvdisplay
  • Determine Logical Volume details by running: sudo lvdisplay

    We are extending the Virtual Disk “Hard disk 1” from 60 GB to 75 GB:


After extending the virtual machine’s disk, you can now execute the script:

sudo bash /opt/variphy/scripts/partresize.sh -p /dev/sda5 -l /dev/variphyinsight01-vg/root

  • NOTE: As of the Insight 11.1.x OVA, the path may change slightly, as the logical display name is changed to another name, e.g. “system” sudo bash /opt/variphy/scripts/partresize.sh -p /dev/sda5 -l /dev/system/root



Confirm the expansion:



After the reboot you can run the following commands to confirm the new

partition size:

Physical Volume details: sudo pvdisplay

Logical Volume details: sudo lvdisplay

Updated on July 26, 2019

Article Attachments

Related Articles