Skip to content

Commit 9778ebb

Browse files
author
Lisa Pettyjohn
committed
OSDOCS-12424#Automate LSO cleanup process
1 parent 51cdac6 commit 9778ebb

File tree

1 file changed

+64
-18
lines changed

1 file changed

+64
-18
lines changed

modules/persistent-storage-local-removing-devices.adoc

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@
66
[id="local-removing-device_{context}"]
77
= Removing a local volume or local volume set
88

9-
Occasionally, local volumes and local volume sets must be deleted. While removing the entry in the resource and deleting the persistent volume is typically enough, if you want to reuse the same device path or have it managed by a different storage class, then additional steps are needed.
10-
11-
[NOTE]
12-
====
13-
The following procedure outlines an example for removing a local volume. The same procedure can also be used to remove symlinks for a local volume set custom resource.
14-
====
9+
Occasionally, you need to delete local volumes (LVs) and local volume sets (LVSs).
1510

1611
.Prerequisites
1712

18-
* The persistent volume must be in a `Released` or `Available` state.
13+
* The persistent volume (PV) must be in a `Released` or `Available` state.
1914
+
2015
[WARNING]
2116
====
@@ -24,33 +19,84 @@ Deleting a persistent volume that is still in use can result in data loss or cor
2419
2520
.Procedure
2621

27-
. Edit the previously created local volume to remove any unwanted disks.
22+
To delete LVs or LVSs, complete the following steps:
23+
24+
. If there are any bound PVs owned by the LV or LVS that is being deleted, delete the corresponding persistent volume claims (PVCs) to release the PVs:
2825

29-
.. Edit the cluster resource:
26+
.. To find bound PVs owned by a particular LV or LVS, run the following command:
3027
+
28+
[source, terminal]
29+
----
30+
$ oc get pv --selector storage.openshift.com/owner-name=<LV_LVS_name> <1>
31+
----
32+
<1> `<LV_LVS_name>` is the name of the LV or LVS.
33+
+
34+
.Example output
3135
[source,terminal]
3236
----
33-
$ oc edit localvolume <name> -n openshift-local-storage
37+
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS VOLUMEATTRIBUTESCLASS REASON AGE
38+
local-pv-3fa1c73 5Gi RWO Delete Available slow <unset> 28s
39+
local-pv-1cec77cf 30Gi RWX Retain Bound openshift/storage my-sc <unset> 168d
3440
----
41+
+
42+
Bound PVs have a status of `Bound` and their corresponding PVCs appear in the `CLAIM` column. In the preceding example, PV `local-pv-1cec77cf` is bound, and its PVC is `openshift/storage`.
3543

36-
.. Navigate to the lines under `devicePaths`, and delete any representing unwanted disks.
44+
.. Delete corresponding PVCs of bound PVs owned by the LV or LVS being deleted by running the following command:
45+
+
46+
[source, terminal]
47+
----
48+
$ oc delete pvc <name>
49+
----
50+
+
51+
In this example, you would delete PVC `openshift/storage`.
3752

38-
. Delete any persistent volumes created.
53+
. Delete the LVs or LVSs by running the applicable following command:
54+
+
55+
.Command for deleting LV
3956
+
4057
[source,terminal]
4158
----
42-
$ oc delete pv <pv-name>
59+
$ oc delete lv <name>
60+
----
61+
+
62+
or
63+
+
64+
.Command for deleting LVS
65+
[source,terminal]
66+
----
67+
$ oc delete lvs <name>
4368
----
4469

45-
. Delete directory and included symlinks on the node.
70+
. If any PV owned by the LV or LVS has a `Retain` reclaim policy, back up any important data, and then delete the PV:
4671
+
47-
[WARNING]
72+
[NOTE]
4873
====
49-
The following step involves accessing a node as the root user. Modifying the state of the node beyond the steps in this procedure could result in cluster instability.
74+
PVs with a `Delete` policy are automatically deleted when you delete the LVs or LVS.
5075
====
5176
+
77+
.. To find PVs with `Retain` reclaim policy, run the following command:
78+
+
79+
[source,terminal]
80+
----
81+
$ oc get pv
82+
----
83+
+
84+
.Example output
5285
[source,terminal]
5386
----
54-
$ oc debug node/<node-name> -- chroot /host rm -rf /mnt/local-storage/<sc-name> <1>
87+
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
88+
local-pv-1cec77cf 30Gi RWX Retain Available my-sc 168d
5589
----
56-
<1> The name of the storage class used to create the local volumes.
90+
+
91+
In this example, PV `local-pv-1cec77cf` has a `Retain` reclaim policy and needs to be manually deleted.
92+
93+
.. Back up any important data on this volume.
94+
95+
.. Delete the PV by running the following command:
96+
+
97+
[source,terminal]
98+
----
99+
$ oc delete pv <name>
100+
----
101+
+
102+
In this example, delete PV `local-pv-1cec77cf`.

0 commit comments

Comments
 (0)