Skip to main content
Skip table of contents

Expanding Appliance Disk Space

Using the Script

Overview

The recommended method for expanding Appliance disk space is to use the provided script, which automates the process.

The manual method is more complex and should only be used as a last resort if the script fails.

If you're running an earlier version of the product (before version 5.13), the script will still work to expand disk space, even though it was not included in that version.

This script is designed to quickly and easily expand the disk size on your Virtual Appliance, helping to prevent potential crashes due to a full disk. The script file is included in all new versions of the Appliance (starting with version 5.13), located in the /loginvsi/bin folder, and is named expand-disk.sh

You can download the script from here.

Prerequisites

This script expands the Appliance's disk using space that has already been added. Before executing the script, ensure that you have added the required disk space to the Appliance in your virtualization environment.

Executing the Script

In the example provided, the Appliance has 100 GB of space, with an additional 100 GB added. The values shown in the screenshots correspond to these amounts. Be sure to refer to your own values based on the amount of space you add.

  1. Log in to your Virtual Appliance console and open the bash shell by selecting Troubleshooting > Open Bash Shell.

Frame 625 (1).png
Frame 626.png
  1. The disk expansion script is named expand-disk.sh and is located in the /loginvsi/bin folder. Move to the aforementioned folder by running the cd /loginvsi/bin command.

  2. Run the script with the ./expand-disk.sh command. If the script can't find the added unpartitioned space, or if the added space is less than 1 GB, it will prompt you to reboot.

Frame 628.png
  1. After rebooting, run ./expand-disk.sh again (remember to relocate to /loginvsi/bin/ first).

  2. The script will detect the unpartitioned space, display the existing partition table, and prompt you to confirm the expansion (in this example, by 100 GB). Press Y to proceed.

Frame 629.png
  1. The script will indicate the partition increased by 100 GB (you can see the difference compared to the previous message) and will prompt you to reboot. After rebooting, run ./expand-disk.sh continue to continue.

Frame 630.png
  1. The final prompt will confirm that the partition and filesystem have been successfully increased.

Frame 631.png

Manually (Only If the Script Fails)

Overview

Reviewing disk utilization of the Login Enterprise Virtual Appliance is essential for maintaining performance and availability, especially as the number of Tests increases and the volume of performance data grows.

You can manage this growth using the data retention features of the Virtual Appliance for raw data and events. For more information, see Configuring Database Data Retention. If disk utilization is not monitored closely, you may encounter issues during upgrades, which can lead to failures.

These steps are intended for the default Debian Virtual Appliance implementation. Results may vary slightly with other Linux operating systems, such as Red Hat.

This process typically takes 2-3 hours and does not require a reboot.

To add more disk space to the Virtual Appliance's primary partition, for example, /dev/sda1, follow these steps:

Preparation

  1. Backup your Virtual Appliance

Take a snapshot of the Virtual Machine or the VM's hard disk using the hypervisor tools. This allows you to restore the Virtual Appliance to its previous configuration if any issues arise.

  1. Grow the Logical Disk

Expand the logical disk that has run out of space. This process is generally straightforward in most hypervisors, including Azure.

  1. Access the Virtual Appliance Bash Shell

Use the console or SSH tools like PuTTY to access the Bash shell.

Some operations may disconnect your SSH session, so using the Login Enterprise Virtual Appliance Console is recommended.

  1. Check Disk Utilization

Run the following command to assess disk utilization:

CODE
df -h
Frame 615.png
  1. Check the Disk Partition Table

Gather the necessary information for the next steps by running the following command:

CODE
sfdisk -l

A physical sector boundary occurs every 4096 bytes. If the partition does not start on a physical sector boundary, it may split I/Os across the boundary, potentially affecting disk performance. However, this should not be an issue for the virtual appliance swap space, as /dev/sda5 is aligned.

Frame 616.png

Moving the Swap Space to the End of the New Partition

  1. Calculate where the new starting sector for /dev/sda2 will be (/dev/sda5 is in /dev/sda2, so it will move when you move /dev/sda2). Use the following formula to determine the new starting sector:

(Total # sectors on disk /dev/sda ) - (# Sectors in partition /dev/sda2 ) - (Starting Sector of /dev/sda2) = New Starting Sector

For illustration, let’s consider a 128 GB disk as the new size (you can verify this by running sdlist -l, which will display the number of sectors for "Disk /dev/sda").

(268,435,456) - (8,382,466) - (54,530,048) = 205,522,944

The best practice is to align the starting sector to a physical sector boundary for optimal performance. To do this, divide the new starting sector by 4096, round down to the nearest integer, and then multiply by 4096. For example, the calculation would look like this:

(205,522,944 / 4,096 ) = 50,176.5, round down to 50,176 and multiply by 4096 equals 205,520,896
This will keep the swap partition /dev/sda5 aligned, while /dev/sda2 is not aligned. 

  1. Before you make the move, you need to turn memory swapping off because your swap space is on /dev/sda5. 

CODE
swapoff -a
  1. Now, use sfdisk to move the /dev/sda2 partition to its new home:

CODE
echo '+205520896' | sfdisk /dev/sda -N 2 --move-data --no-reread
Frame 617.png

The partition remapping process may take some time. In the example above, it typically took about 2-3 hours. During this period, monitor the disk activity to observe the machine remapping the partition.

To check the status of the remapping, you can run the following commands:

CODE
tail /root/sfdisk-sda2.move

and

CODE
cat /root/sfdisk-sda2.move | more

Once the move is complete, you will notice that /dev/sda5 has also been relocated.

Below is an example of what the partition layout looks like after the move is finished. Pay special attention to the new starting sectors for both /dev/sda2 and /dev/sda5:

Frame 618.png

During the 3-hour remapping process, you can monitor the disk I/O activity. Here’s what the disk I/O might look like:

Expanding the Primary Disk into its New Space

Frame 619.png
  1. To utilize the newly allocated space, expand the /dev/sda1 partition:

CODE
echo ',+' | sfdisk /dev/sda -N 1 --no-reread

After expanding the /dev/sda1 partition, it should reflect the new size. The partition should now be 124 GB.

CODE
sfdisk -l
Frame 620.png
  1. At this point, you have successfully expanded your disk partition; however, the filesystem on the partition has not yet been expanded. To expand the filesystem capacity, you need to instruct the OS to rescan the partitions using the 'partprobe' command.

First, you'll need to install 'parted' with the following command, then run 'partprobe'.

CODE
apt-get install parted
partprobe

Now that you have rescanned the partitions, you can expand the filesystem on /dev/sda1 to utilize the new space. Run the following command to expand the filesystem:

Frame 621.png
CODE
resize2fs /dev/sda1

After executing this command, your Login Enterprise Virtual Appliance primary disk will have 122 GB of usable disk space - /dev/sda1

Frame 622.png
Frame 623.png

Finishing Up

Turn Swapping back on

  1. Once the filesystem expansion is complete, re-enable swapping by using the following command:

CODE
swapon -a
Frame 624.png
  1. You have successfully expanded the Virtual Appliance disk and filesystem. The additional disk space is now available for use.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.