Skip to content

Resizing VMs

It may happen that a virtual machine needs more resources, for example additional storage or more RAM.

In OpenStack you can select existing Flavors or create new, custom flavors with our MyEngineers®.

Resizing vCPUs and RAM

Resizing in Horizon

  1. Log in to Horizon.
  2. Switch to the Instance Overview. (Compute > Instances)
  3. Open the dropdown menu of the desired machine.
  4. Select Resize Instance.
  5. In New Flavor choose the desired flavor.
  6. Click Resize.
  7. Wait until the operation is finished.
  8. Confirm resize/migration.
  9. The machine will be automatically powered on again.
  10. After it boots, verify with df -h that the size increase has been applied.
  11. If the disk was not enlarged, you can adjust the partition with parted/fdisk or restart the VM if a downtime is planned.

Resizing VM storage

CPU and RAM are automatically adjusted when resizing a VM. The storage size is only increased when it is SSD storage.

If you use Ceph volumes as VM storage, additional steps are required (see below).

Resizing Ceph and SSD Volumes

When expanding a volume no restart is required. However, you must manually adjust the partition size and the filesystem.

If a VM still shows the old storage size after its volumes have been expanded, you need to make the following changes.

Manual changes to partitions/filesystems

Before manually adjusting partitions and filesystems you should always create a current snapshot.

  1. Check available disks
    You can list the disks of a VM, for example, with lsblk:

    lsblk
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    sda       8:0    0  500G  0 disk
    ├─sda1    8:1    0  449G  0 part /
    
  2. Adjust the partition(s) with gdisk

    gdisk /dev/sda
    
    • p shows the partition table
    • d deletes an existing partition
    • n creates a new partition with maximum size
    • w writes the changes
  3. Reload the partition table and enlarge the filesystem

    partprobe /dev/sda
    partprobe /dev/sda1
    resize2fs /dev/sda1
    
  4. Verify the successful resize

    lsblk
    
    NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    sda 8:0 0 500G 0 disk
    ├─sda1 8:1 0 499G 0 part /
    

    The partitions should now display the new sizes.

Resizing via the OpenStack CLI

Since a newer API version, resizing can also be performed directly through the OpenStack CLI – also without shutting down the VM:

openstack --os-volume-api-version 3.42 volume set --size ${newSize} ${volumeIdOrName}