Home / Best Practices / Storage / Cleaning Up Local Storage Service Resources

Cleaning Up Local Storage Service Resources

If you need to delete the local storage cluster and redeploy a new one, follow this guide to clean up the resources related to the local storage service.

Notes

Before cleaning up local storage, ensure that all PVC (Persistent Volume Claim) and PV (Persistent Volume) resources using TopoLVM storage have been deleted.

Delete Snapshot Class

  1. Delete the snapshot class.

    kubectl delete VolumeSnapshotClass csi-topolvm-snapshotclass
  2. Verify that the snapshot class cleanup is complete.

    kubectl get VolumeSnapshotClass | grep topolvm

    If this command produces no output, the cleanup is complete.

Delete Storage Class

  1. In the left navigation bar, click Storage > StorageClasses.

  2. Click > Delete to delete all storage classes using the TopoLVM storage solution.

Delete TopoLVM Cluster

This step should be executed after completing the previous step.

  1. Click Clusters > Resources, select the appropriate cluster, and search for TopolvmCluster.

  2. Click > Update, set the spec.cleanup field to true.

  3. Click Update.

  4. Delete the TopoLVM Cluster.

    kubectl delete topolvmcluster -n nativestor-system topolvm
  5. Verify that the TopoLVM Cluster cleanup is complete.

    kubectl get topolvmcluster -n nativestor-system | grep topolvm

    If this command produces no output, the cleanup is complete.

Delete TopoLVM Operator

This step should be executed after completing the previous step.

  1. Delete the TopoLVM Operator.

    kubectl -n nativestor-system delete subscriptions.operators.coreos.com topolvm-operator
  2. Verify that the TopoLVM Operator cleanup is complete.

    kubectl get subscriptions.operators.coreos.com -n nativestor-system | grep topolvm

    If this command produces no output, the cleanup is complete.

  3. Verify that the TopoLVM cleanup is complete.

    kubectl get all -n nativestor-system

    If this command produces no output, the cleanup is complete.

Clean Up Disks

Notes

Before using the sgdisk command to clean up disks, make sure that sgdisk is installed.

Steps

  1. Check partition information.

    lsblk -f /dev/<device_name>

    When the FSTYPE column in the output is empty, the cleanup is complete.

  2. If the FSTYPE column shows LVM2_member, use LVM management commands to delete LV (Logical Volume), VG (Volume Group), and PV (Physical Volume).

    vgs     # View the VG name 
    vgremove <vg_name>    # Remove the VG; it will prompt that LV exists, reply with 'y' to delete
    pvremove /dev/<device_name>    # Unlink the PV from LVM
    sgdisk --zap-all /dev/<device_name>    # Use the sgdisk command to clean up the disk