Resize
We can resize the volume by updating the PVC yaml to the desired size and apply it. The ZFS Driver will take care of updating the quota in case of dataset. If we are using a Zvol and have mounted it as ext2/3/4 or xfs file system, the driver will take care of expanding the volume via reize2fs/xfs_growfs binaries.
For resize, storageclass that provisions the pvc must support resize. We should have allowVolumeExpansion as true in storageclass.
note
btrfs does not support online volume resize, so we can not resize the btrfs volumes.
Create the PVC using the above storage class
OpenEBS ZFS driver supports Online Volume expansion, which means that we can expand the volume even if volume is being used by the application and we also do not need to restart the application to use the expanded volume, the ZFS Driver will take care of making the space availbale to it.
note
File system expansion does not happen until a Application pod references the resized volume, so if no pods referencing the volume are running, file system expansion will not happen.
Deploy the application using the PVC. Here is sample yaml for the application:
Check the current PVC status
Exec into the application pod and check the size
Deploy the application using the PVC which supports volume expansion. Once the application pod is deployed, we will expand the PVC to 5Gi from 4Gi. Edit the PVC yaml and update the size to 5Gi and apply it:
Apply the above yaml which will resize the volume.
Check the PVC yaml.
Here you see in the message that it is waiting on FileSystemResizePending. The resize request will go to the node where appliccation pod is running. The ZFS driver node agent will resize the filesytem for the application. Keep checking the PVC yaml for FileSystemResizePending to go away, once PVC is resized, the yaml will look like this:
Also, we can exec into the application pod and verify the same:
As we can see the volume mount point /datadir
is showing that it has been resized.