// Module included in the following assemblies:
//
// storage/persistent_storage/persistent_storage_local/persistent-storage-using-lvms.adoc

:_mod-docs-content-type: PROCEDURE
[id="performing-a-forced-cleanup_{context}"]
= Performing a forced clean-up

[role="_abstract"]
Perform a forced clean-up by removing all {lvms-first} custom resources (CRs) when disk or node-related problems continue after standard troubleshooting, to restore proper storage functioning.

If the disk or node-related problems persist even after you have completed the troubleshooting procedures, you must perform a forced clean-up. A forced clean-up is used to address persistent issues and ensure the proper functioning of {lvms}.

.Prerequisites
* You have installed the {oc-first}.
* You have logged in to the {oc-first} as a user with `cluster-admin` permissions.
* You have deleted all the persistent volume claims (PVCs) that were created by using {lvms}.
* You have stopped the pods that are using the PVCs that were created by using {lvms}.

.Procedure
. Switch to the namespace where you have installed the {lvms} Operator by running the following command:
+
[source,terminal]
----
$ oc project <namespace>
----

. Check if the `LogicalVolume` custom resources are present by running the following command:
+
[source,terminal]
----
$ oc get logicalvolume
----

.. If the `LogicalVolume` CRs are present, delete them by running the following command:
+
[source,terminal]
----
$ oc delete logicalvolume <name>
----
+
Replace `<name>` with the name of the `LogicalVolume` CR.

.. After deleting the `LogicalVolume` CRs, remove their finalizers by running the following command:
+
[source,terminal]
----
$ oc patch logicalvolume <name> -p '{"metadata":{"finalizers":[]}}' --type=merge
----
+
Replace `<name>` with the name of the `LogicalVolume` CR.

. Check if the `LVMVolumeGroup` CRs are present by running the following command:
+
[source,terminal]
----
$ oc get lvmvolumegroup
----

.. If the `LVMVolumeGroup` CRs are present, delete them by running the following command:
+
[source,terminal]
----
$ oc delete lvmvolumegroup <name>
----
+
Replace `<name>` with the name of the `LVMVolumeGroup` CR.

.. After deleting the `LVMVolumeGroup` CRs, remove their finalizers by running the following command:
+
[source,terminal]
----
$ oc patch lvmvolumegroup <name> -p '{"metadata":{"finalizers":[]}}' --type=merge
----
+
Replace `<name>` with the name of the `LVMVolumeGroup` CR. 

. Delete any `LVMVolumeGroupNodeStatus` CRs by running the following command:
+
[source,terminal]
----
$ oc delete lvmvolumegroupnodestatus --all
----

. Delete the `LVMCluster` CR by running the following command:
+
[source,terminal]
----
$ oc delete lvmcluster --all
----

.. After deleting the `LVMCluster` CR, remove its finalizer by running the following command:
+
[source,terminal]
----
$ oc patch lvmcluster <name> -p '{"metadata":{"finalizers":[]}}' --type=merge
----
+
Replace `<name>` with the name of the `LVMCluster` CR. 
