Expanding a virtual machine disk

You can enlarge the size of a virtual machine’s (VM) disk to provide a greater storage capacity by resizing the disk’s persistent volume claim (PVC).

However, you cannot reduce the size of a VM disk.

Enlarging a virtual machine disk

VM disk enlargement makes extra space available to the virtual machine. However, it is the responsibility of the VM owner to decide how to consume the storage.

If the disk is a Filesystem PVC, the matching file expands to the remaining size while reserving some space for file system overhead.

Procedure

  1. Edit the PersistentVolumeClaim manifest of the VM disk that you want to expand:

    1. $ oc edit pvc <pvc_name>
  2. Change the value of spec.resource.requests.storage attribute to a larger size.

    1. apiVersion: v1
    2. kind: PersistentVolumeClaim
    3. metadata:
    4. name: vm-disk-expand
    5. spec:
    6. accessModes:
    7. - ReadWriteMany
    8. resources:
    9. requests:
    10. storage: 3Gi (1)
    11. ...
    1The VM disk size that can be increased

Additional resources