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.

Volumes become read-only
Suspending a drive makes all volumes on that drive read-only. Applications attempting to write to these volumes fail until the drive resumes.

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:

  1. DirectPV remounts volumes to an empty temporary directory.
  2. Volumes become read-only.
  3. The drive status shows Suspended.
  4. 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_ID arguments
  • --nodes flag
  • --drives flag

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:

  1. Resume the drive using kubectl directpv resume drives.
  2. Verify drive status using kubectl directpv list drives.