kubectl directpv list drives
The kubectl directpv list drives command displays information about drives initialized and managed by DirectPV.
Use this command to view drive status, capacity, volume counts, and custom labels.
For information on adding drives, see Managing Drives.
Syntax
Aliases
The following aliases have the same function:
kubectl directpv list drivekubectl directpv list dr
Parameters
--all
Optional
List all drives regardless of status.
By default, only drives in ready status are shown.
--nodes
Optional
Filter output by node names. Supports ellipsis expansion notation.
Short form: -n
--drives
Optional
Filter output by drive names. Supports ellipsis expansion notation.
Short form: -d
--status
Optional
Filter output by drive status.
Valid values: error, lost, moving, ready, removed
--labels
Optional
Filter output by drive labels.
Supports comma-separated key=value pairs.
--show-labels
Optional
Display custom labels as an additional column in the output.
--output
Optional
Set the output format.
Valid values: json, yaml, wide
Short form: -o
--no-headers
Optional
Omit column headers from the output.
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
List drives in ready status
Display all drives that are available for volume provisioning. This is the default behavior when no flags are specified:
kubectl directpv list drives
List all drives regardless of status
Include drives in all states, such as error, lost, or removed:
kubectl directpv list drives --all
List drives with errors
Identify drives that have encountered filesystem or hardware issues and may need repair or replacement:
kubectl directpv list drives --status=error
Filter drives by node and name
Use ellipsis expansion to filter by multiple nodes and drive names.
This example lists SATA drives sda through sdf on nodes node1 through node4:
kubectl directpv list drives --nodes=node{1...4} --drives=sd{a...f}
Filter drives by label
List only drives with a specific label.
For information on setting labels, see kubectl directpv label drives:
kubectl directpv list drives --labels tier=hot
Display labels and extended information
Show custom labels and additional drive details:
kubectl directpv list drives --show-labels --output wide
Export drive information
Output drive data in YAML or JSON format for scripting or backup purposes:
kubectl directpv list drives --output yaml
Behavior
Default filtering
By default, the command only lists drives in ready status.
Use --all to see drives in all statuses, or --status to filter by a specific status.
Output columns
| Column | Description |
|---|---|
DRIVE ID |
Unique identifier for the drive |
NODE |
Kubernetes node where the drive is located |
NAME |
Device name (for example, sdb, nvme0n1) |
MAKE |
Drive manufacturer, if available |
SIZE |
Total drive capacity |
FREE |
Available capacity for new volumes |
ALLOCATED |
Capacity used by existing volumes |
VOLUMES |
Number of volumes on the drive |
STATUS |
Current drive status |
Status values
| Status | Description |
|---|---|
Ready |
Drive is available for volume provisioning |
Error |
Drive has encountered an error |
Lost |
Drive is no longer accessible |
Moving |
Drive data is being migrated |
Removed |
Drive has been removed from DirectPV |
Additional status flags may appear:
SchedulingDisabled- Drive is cordoned and will not receive new volumesSuspended- Drive is suspended for maintenance