Resizing Disk Space for a KVM Virtual Machine
  • 21 Jun 2024
  • 6 Minutes to read
  • Contributors
  • PDF

Resizing Disk Space for a KVM Virtual Machine

  • PDF

Article summary

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:

  1. Locate the original qcow2 file on the KVM host and make a copy of the qcow2 file.

  2. Open the console of the $SO_Core domain to check the disk usage and halt the Skylight orchestrator before resizing.

  3. Resize the qcow2 file using the qemu-img utility.

  4. Restart the $SO_Core domain.

  5. Open the console of the $SO_Core domain to check that disk usage has changed.

  6. Remove the copy of the qcow2 file.

To resize the disk space for a KVM virtual machine ($SO_Core domain)

  1. Open an SSH session on the KVM host and log in as the $skylight user.

  2. Access the directory where the qcow2 file for the $SO_Core domain is stored and lists its contents:
    cd $dir
    ls

  3. Confirm that the qcow2 file for the $SO_Core domain is in the directory. If it is not, you must locate it.

  4. Start virsh and list the domains managed by the KVM host by entering:
    virsh
    list --all

  5. Confirm that the $SO_Core domain is in the list and is running.

  6. 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.

  7. Log in as the $visionems user.

  8. Check the available disk space by entering: disk show

  9. Stop app_server by entering: service stop app_server

  10. Stop the Skylight orchestrator by entering: halt

  11. When prompted to proceed with halt, enter: y
    A message indicates that the system has powered down, then the virsh prompt is displayed.

  12. Close virsh and return to the CLI of the KVM host by entering: exit

  13. 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".

  14. Check the size of the qcow2 file (before resizing) by entering: qemu-img info ./SO_x.x.x_yyyy_vm_core.qcow2

  15. 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.

  16. If prompted for the $skylight user password, enter it.

  17. Check the size of the qcow2 file (after resizing) by entering: qemu-img info ./SO_x.x.x_yyyy_vm_core.qcow2

  18. Verify that the virtual size of the qcow2 file has increased by the amount you entered in the resize command.

  19. 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.

  20. Log in as the $visionems user.

  21. Check the disk usage (after resizing) and confirm that the available space (the second value) has changed by entering: disk show

  22. Start app_server by entering: service start app_server

  23. Close the console of the $SO_Core domain by entering this key combination: Ctrl + ]
    You are returned to the CLI of the KVM host.

  24. Confirm that the $SO_Core domain is running by entering: virsh list --all

  25. If the resize was successful, delete the backup copy of the qcow2 file:
    rm ./backup/SO_x.x.x_yyyy_vm_core.qcow2

  26. Close 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:

  1. If necessary, open an SSH session on the KVM host and log in as the $skylight user.

  2. Check if the $SO_Core domain is running: virsh list --all

  3. If the domain is running, shut it down: virsh shutdown $SO_Core

  4. Access the domain directory where the original qcow2 file for the $SO_Core domain is stored and list its contents:
    cd $dir
    ls

  5. Rename the original qcow2 file:
    mv ./SO_x.x.x_yyyy_vm_core.qcow2
    ./SO_x.x.x_yyyy_vm_core-ORIGINAL.qcow2

  6. Move 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.qcow2

  7. Start the $SO_Core domain (using the qcow2 file you must move) and check that it is running:
    virsh start $SO_Core
    virsh list –all

  8. Confirm that the $SO_Core domain is in the list and is running.

  9. If reverting to the backup qcow2 file was successful, delete the original qcow2 file:
    rm ./SO_x.x.x_yyyy_vm_core-ORIGINAL.qcow2

  10. View the contents of the directory to confirm that the file has been removed: ls backup

  11. 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



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.