Expanding virtual storage by adding blank disk images
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.
|
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.
Prerequisites
At least one available persistent volume.
Install the OpenShift CLI (
oc
).
Procedure
Edit the
DataVolume
manifest:apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: blank-image-datavolume
spec:
source:
blank: {}
pvc:
storageClassName: "hostpath" (1)
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi
1 Optional: If you do not specify a storage class, the default storage class is applied. Create the blank disk image by running the following command:
$ oc create -f <blank-image-datavolume>.yaml
Additional resources
- Configure preallocation mode to improve write performance for data volume operations.