- Print
- PDF
Resizing Disk Space for a KVM Virtual Machine
This article explains how to resize the disk space available for a Skylight orchestrator deployed as a KVM virtual Machine. Resizing the disk space is done using the resize function of the qemu-img utility. The resize function allows you to change the size of the qcow2 file that contains the disk image of the Skylight orchestrator virtual machine. The disk image would have been previously installed on a server called the KVM host.
Notes:
Resizing requires downtime on the Skylight orchestrator machine.
If your deployment includes several KVM virtual Skylight orchestrator machines, you will need to repeat the resizing procedure for each machine that you want to resize.
Requirements for the KVM Host
Before resizing disk storage for a Skylight orchestrator that has been installed as a KVM virtual machine, make sure the following requirements are met:
A. The procedure must be executed as the skylight user so therefore you must know the credentials for this account and obtain the IP address for the KVM host (Ubuntu, CentOS or Red Hat).
B. The following tools must be available on the KVM host and configured in it’s path:
- virsh: CLI tool for managing KVM hosts and domains. You will use virsh to stop and start the Skylight orchestrator domain.
- qemu-img: Disk image utility that you will use to resize the disk storage defined for the Skylight orchestrator in its qcow file.
C. Obtain the qcow2 file that was used to install the Skylight orchestrator domain on the KVM host, assuming that:
The qcow file is named:
SO_x.x.x_yyyy_vm_core.qcow2
where x.x.x is the release number and yyyy is the build number.The Skylight orchestrator domain was deployed in the following directory on the KVM host and the qcow2 file is stored in the same location, as shown below:
/data/kvm_guests/Orchestrator_Core
This directory is referred to as $dir in the procedure. If the Skylight orchestrator was deployed in a different location, you must adapt the procedure accordingly.
D. Sufficient disk space must be available on the KVM host in order to accommodate the original qcow2 file (50 GB), the required increase in disk space and, temporarily, a back-up copy of the qcow2 file (50 GB). You can determine the available space required on the host, with the following equation:
Space on host = 50 GB (original qcow2) + 50 GB (copy of qcow2) + extra space
For example, to extend the disk allocation by 100 GB, you will need 200 GB of free disk space on the host.
Requirements for the Skylight orchestrator Virtual Machine
Note: In KVM terminology, a virtual machine is called a domain.
Before starting the procedure, make sure the following requirements are met:
A. The Skylight orchestrator domain must already exist. For more information, see KVM Virtual machine Installation and Connectivity.
B. You will need the following information for the Skylight orchestrator domain:
- Domain name
If the domain was named something other than Orchestrator_Core, you must adapt the procedure accordingly. However, the domain name is referred to as $SO_Core in the following procedure.
- Username and password for the visionems user
This user is referred to as $visionems in the procedure. If you use a different user account, you must adapt the procedure accordingly. The IP address of the domain is good to know but it is not needed for the procedure.
KVM Procedure
To resize the disk space for a KVM virtual machine
Resizing the disk space for a KVM virtual machine involves the following tasks that are all performed from an SSH session on the KVM host:
Locate the original qcow2 file on the KVM host and make a copy of the qcow2 file.
Open the console of the $SO_Core domain to check the disk usage and halt the Skylight orchestrator before resizing.
Resize the qcow2 file using the qemu-img utility.
Restart the $SO_Core domain.
Open the console of the $SO_Core domain to check that disk usage has changed.
Remove the copy of the qcow2 file.
To resize the disk space for a KVM virtual machine ($SO_Core domain)
Open an SSH session on the KVM host and log in as the $skylight user.
Access the directory where the qcow2 file for the $SO_Core domain is stored and lists its contents:
cd $dir
lsConfirm that the qcow2 file for the $SO_Core domain is in the directory. If it is not, you must locate it.
Start virsh and list the domains managed by the KVM host by entering:
virsh
list --allConfirm that the $SO_Core domain is in the list and is running.
Access the console of the $SO_Core domain by entering: console $SO_Core
You may need to press Enter to access the login prompt of the AppMon CLI.Log in as the $visionems user.
Check the available disk space by entering: disk show
Stop app_server by entering: service stop app_server
Stop the Skylight orchestrator by entering: halt
When prompted to proceed with halt, enter: y
A message indicates that the system has powered down, then the virsh prompt is displayed.Close virsh and return to the CLI of the KVM host by entering: exit
Make a copy of the qcow2 file for the $SO_Core domain by entering:
mkdir backup
cp *.qcow2 ./backup
This copy of the qcow2 file could be reinstated as the $SO_Core domain if it is not possible to resize the qcow2 file. See "Reverting to the Backup Copy of the qcow2".Check the size of the qcow2 file (before resizing) by entering: qemu-img info ./SO_x.x.x_yyyy_vm_core.qcow2
Resize the qcow2 file using the qemu-img utility: sudo qemu-img resize ./SO_x.x.x_yyyy_vm_core.qcow2 +zzzG
where zzz is the additional GB that you want to assign to the virtual machine.If prompted for the $skylight user password, enter it.
Check the size of the qcow2 file (after resizing) by entering: qemu-img info ./SO_x.x.x_yyyy_vm_core.qcow2
Verify that the virtual size of the qcow2 file has increased by the amount you entered in the resize command.
Start the $SO_Core domain and access its console by entering: virsh start $SO_Core --console
You may need to press Enter one or more times to reach the login prompt.Log in as the $visionems user.
Check the disk usage (after resizing) and confirm that the available space (the second value) has changed by entering: disk show
Start app_server by entering: service start app_server
Close the console of the $SO_Core domain by entering this key combination: Ctrl + ]
You are returned to the CLI of the KVM host.Confirm that the $SO_Core domain is running by entering: virsh list --all
If the resize was successful, delete the backup copy of the qcow2 file:
rm ./backup/SO_x.x.x_yyyy_vm_core.qcow2Close the SSH session on the KVM host.
Reverting to the backup copy of qcow2
If a problem occurs during the resizing procedure, with the following procedure you can revert to the copy of the qcow2 file that you made in the backup directory:
If necessary, open an SSH session on the KVM host and log in as the $skylight user.
Check if the $SO_Core domain is running: virsh list --all
If the domain is running, shut it down: virsh shutdown $SO_Core
Access the domain directory where the original qcow2 file for the $SO_Core domain is stored and list its contents:
cd $dir
lsRename the original qcow2 file:
mv ./SO_x.x.x_yyyy_vm_core.qcow2
./SO_x.x.x_yyyy_vm_core-ORIGINAL.qcow2Move the copy of the qcow2 file from the backup directory to the domain directory:
mv ./backup/SO_x.x.x_yyyy_vm_core.qcow2
./SO_x.x.x_yyyy_vm_core.qcow2Start the $SO_Core domain (using the qcow2 file you must move) and check that it is running:
virsh start $SO_Core
virsh list –allConfirm that the $SO_Core domain is in the list and is running.
If reverting to the backup qcow2 file was successful, delete the original qcow2 file:
rm ./SO_x.x.x_yyyy_vm_core-ORIGINAL.qcow2View the contents of the directory to confirm that the file has been removed: ls backup
Close the SSH session on the KVM host.
© 2024 Cisco and/or its affiliates. All rights reserved.
For more information about trademarks, please visit: Cisco trademarks
For more information about legal terms, please visit: Cisco legal terms
For legal information about Accedian Skylight products, please visit: Accedian legal terms and tradmarks