kubectl directpv suspend drives
The kubectl directpv suspend drives command suspends drives and marks their volumes as read-only.
Suspending a drive mounts its volumes to an empty temporary directory, allowing StatefulSet pods to start even when the underlying drive is unavailable.
Suspend drives before performing maintenance tasks such as drive repair.
To restore normal operation, use kubectl directpv resume drives.
Syntax
Parameters
DRIVE_ID
Optional
The unique identifier of one or more drives to suspend.
Specify multiple drive IDs separated by spaces.
Use kubectl directpv list drives to find drive IDs.
--dangerous
Required
Confirms that you understand suspending drives makes their volumes read-only. The command does not run without this flag.
--nodes
Optional
Suspend drives on specific nodes. Specify multiple nodes as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -n
--drives
Optional
Suspend drives by name. Specify multiple drives as a comma-separated list or by repeating the flag. Supports ellipsis expansion notation.
Short form: -d
--dry-run
Optional
Display what drives would be suspended without making changes.
Global flags
This command supports the following global flags:
| Flag | Description |
|---|---|
--kubeconfig |
Path to the kubeconfig file to use for CLI requests. |
--quiet |
Suppress printing error messages. |
Examples
Suspend a drive by ID
Suspend a specific drive before performing repair or maintenance:
kubectl directpv suspend drives af3b8b4c-73b4-4a74-84b7-1ec30492a6f0 --dangerous
Suspend all drives on a node
Suspend all drives on node1 for node-level maintenance:
kubectl directpv suspend drives --nodes=node1 --dangerous
Suspend a specific drive on a specific node
Suspend only drive sda on node1:
kubectl directpv suspend drives --nodes=node1 --drives=sda --dangerous
Preview suspend operation
Check which drives would be suspended without making changes:
kubectl directpv suspend drives --nodes=node1 --dry-run
Behavior
Why suspend drives?
By Kubernetes design, an active StatefulSet workload requires that all of its Pods are in a running state. A faulty drive prevents the StatefulSet from starting.
Suspending a drive provides a workaround by mounting the affected volumes to an empty temporary directory (/var/lib/directpv/tmp) with read-only access.
This allows the StatefulSet to start while repairing or replacing the drive.
What happens when suspending a drive?
When you suspend a drive:
- DirectPV remounts volumes to an empty temporary directory.
- Volumes become read-only.
- The drive status shows
Suspended. - StatefulSet Pods using these volumes can start (with read-only data access).
Selection requirements
You must specify at least one selection method:
- One or more
DRIVE_IDarguments --nodesflag--drivesflag
Verify drive status
After suspending, verify the drive status:
kubectl directpv list drives --all
Suspended drives show Ready,Suspended in the status column.
After maintenance
After completing maintenance or repair:
- Resume the drive using
kubectl directpv resume drives. - Verify drive status using
kubectl directpv list drives.