HOWTO - Check Volume Usage
As an operator, I may need to know the usage of a volume. This document describes how to check the usage of user volumes, group volumes, and PV data volumes. Before checking the volume usage, please make sure you can access your Kubernetes cluster by kubectl, we use kubectl exec <pod> -- df /path/to/the/volume to check the volume
Usage of User Volume
Because user volume can only be mounted by a notebook pod, we need to check the usage by the user's running notebook pod.
Find the user's notebook pod. If the pod is not launched, you cannot check the user volume usage.
kubectl -n hub get podFind the pod
jupyter-<username>.The user volume is mounted at
/home/jovyan. Use the commanddfto check the usage.kubectl -n hub exec jupyter-<username> -- df -h /home/jovyanThe sample output
Filesystem Size Used Avail Capacity Mounted on /dev/rbd11 49G 53M 47G 1% /home/jovyan
Usage of Group Volume
Note: This method can only works if the configuration
primehub.sharedVolumeStorageClassis not set
If the shared volume of a group is enabled, an NFS server is created as the group volume. To check the volume usage, we can check the usage in the NFS server pod.
Find the group NFS server pod
kubectl -n hub get podFind the pod
nfs-project-<group>-0.The disk is mounted at
/exportskubectl -n hub exec <pod-name> -- df /exportsThe sample output
Filesystem Size Used Avail Capacity Mounted on /dev/rbd11 196G 3.9M 182G 3% /exports
Usage of PV Data Volume
Note: This method only works if the configuration
primehub.sharedVolumeStorageClassis not set
If a PV data volume is configured as auto provisioning, an NFS server is created as the data volume. To check the volume usage, we can check the usage in the NFS server pod.
Find the pod of the PV data volume NFS server
kubectl -n hub get podFind the pod
nfs-dataset-<dataset>-0.The disk is mounted at
/exportskubectl -n hub exec <pod-name> -- df /exportsThe sample output.
Filesystem Size Used Avail Capacity Mounted on /dev/rbd11 196G 3.9M 182G 3% /exports