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
-
Delete the snapshot class.
kubectl delete VolumeSnapshotClass csi-topolvm-snapshotclass -
Verify that the snapshot class cleanup is complete.
kubectl get VolumeSnapshotClass | grep topolvmIf this command produces no output, the cleanup is complete.
Delete Storage Class
-
In the left navigation bar, click Storage > StorageClasses.
-
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.
-
Click Clusters > Resources, select the appropriate cluster, and search for TopolvmCluster.
-
Click
> Update, set the spec.cleanupfield totrue. -
Click Update.
-
Delete the TopoLVM Cluster.
kubectl delete topolvmcluster -n nativestor-system topolvm -
Verify that the TopoLVM Cluster cleanup is complete.
kubectl get topolvmcluster -n nativestor-system | grep topolvmIf this command produces no output, the cleanup is complete.
Delete TopoLVM Operator
This step should be executed after completing the previous step.
-
Delete the TopoLVM Operator.
kubectl -n nativestor-system delete subscriptions.operators.coreos.com topolvm-operator -
Verify that the TopoLVM Operator cleanup is complete.
kubectl get subscriptions.operators.coreos.com -n nativestor-system | grep topolvmIf this command produces no output, the cleanup is complete.
-
Verify that the TopoLVM cleanup is complete.
kubectl get all -n nativestor-systemIf 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.
-
For Ubuntu, use the command:
sudo apt install gdisk -
For RedHat or CentOS, use the command:
sudo yum install gdisk
Steps
-
Check partition information.
lsblk -f /dev/<device_name>When the
FSTYPEcolumn in the output is empty, the cleanup is complete. -
If the
FSTYPEcolumn showsLVM2_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