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 dataset 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 pod
Find the pod
jupyter-<username>
.The user volume is mounted at
/home/jovyan
. Use the commanddf
to check the usage.kubectl -n hub exec jupyter-<username> -- df -h /home/jovyan
The 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.sharedVolumeStorageClass
is 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 pod
Find the pod
nfs-project-<group>-0
.The disk is mounted at
/exports
kubectl -n hub exec <pod-name> -- df /exports
The sample output
Filesystem Size Used Avail Capacity Mounted on /dev/rbd11 196G 3.9M 182G 3% /exports
Usage of PV Dataset Volume
Note: This method only works if the configuration
primehub.sharedVolumeStorageClass
is not set
If a PV dataset is configured as auto provisioning, an NFS server is created as the dataset volume. To check the volume usage, we can check the usage in the NFS server pod.
Find the pod of the PV dataset NFS server
kubectl -n hub get pod
Find the pod
nfs-dataset-<dataset>-0
.The disk is mounted at
/exports
kubectl -n hub exec <pod-name> -- df /exports
The sample output.
Filesystem Size Used Avail Capacity Mounted on /dev/rbd11 196G 3.9M 182G 3% /exports