Increase the size of a disk storing home directories

Increase the size of a disk storing home directories#

export CLUSTER_NAME=<cluster-name>;
export HUB_NAME=<hub-name>

To increase the size of a disk storing users’ home directories, we need to increase its size in the tfvars file of the cluster

ebs_volumes = {
  "staging" = {
    size        = 100  # in GB. Increase this!
    type        = "gp3"
    name_suffix = "staging"
    tags        = { "2i2c:hub-name": "staging" }
  }
}
persistent_disks = {
  "staging" = {
    size        = 100  # in GB. Increase this!
    name_suffix = "staging"
  }
}

After updating the tfvars file, we need to plan and apply the changes using terraform:

terraform workspace select $CLUSTER_NAME
terraform plan -var-file=projects/$CLUSTER_NAME.tfvars
terraform apply -var-file=projects/$CLUSTER_NAME.tfvars

Warning

The size of a disk can only be increased, not decreased.

Once terraform has successfully applied, we also need to grow the size of the filesystem.

  1. Run deployer use-cluster-credentials $CLUSTER_NAME to gain kubectl access to the cluster

  2. Run kubectl -n $HUB_NAME get pods to find the NFS deployment pod name. It should look something like ${HUB_NAME}-nfs-deployment-<HASH>.

  3. Exec into the the quota enforcer container: kubectl -n $HUB_NAME exec -it $POD_NAME -c enforce-xfs-quota -- /bin/bash

  4. Run df -h to find out where the directory is mounted, it’s current size, and if that size reflects what you just deployed with terraform or not. The directory is usually under /export, but is not guaranteed.

  5. Run xfs_growfs $DIR_NAME to resize the directory

  6. Re-run df -h to confirm new size