You can increase your storage capacity or create new data partitions by adding blank disk images to OKD Virtualization.

About data volumes

DataVolume objects are custom resources that are provided by the Containerized Data Importer (CDI) project. Data volumes orchestrate import, clone, and upload operations that are associated with an underlying persistent volume claim (PVC). You can create a data volume as either a standalone resource or by using the dataVolumeTemplate field in the virtual machine (VM) specification.

  • VM disk PVCs that are prepared by using standalone data volumes maintain an independent lifecycle from the VM. If you use the dataVolumeTemplate field in the VM specification to prepare the PVC, the PVC shares the same lifecycle as the VM.

After a PVC is populated, the data volume that you used to create the PVC is no longer needed. OKD Virtualization enables automatic garbage collection of completed data volumes by default. Standalone data volumes, and data volumes created by using the dataVolumeTemplate resource, are automatically garbage collected after completion.

Creating a blank disk image with data volumes

You can create a new blank disk image in a persistent volume claim by customizing and deploying a data volume configuration file.

  • At least one available persistent volume.

  • Install the OpenShift CLI (oc).

  1. Edit the DataVolume manifest:

    apiVersion: cdi.kubevirt.io/v1beta1
    kind: DataVolume
      name: blank-image-datavolume
          blank: {}
        storageClassName: "hostpath" (1)
          - ReadWriteOnce
            storage: 500Mi
    1 Optional: If you do not specify a storage class, the default storage class is applied.
  2. Create the blank disk image by running the following command:

    $ oc create -f <blank-image-datavolume>.yaml

Additional resources