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

List all drives in ready status:

kubectl directpv list drives

Output:

┌─────────────────────────────────────────┬───────┬──────┬──────┬─────────┬─────────┬───────────┬─────────┬────────┐
│ DRIVE ID                                │ NODE  │ NAME │ MAKE │ SIZE    │ FREE    │ ALLOCATED │ VOLUMES │ STATUS │
├─────────────────────────────────────────┼───────┼──────┼──────┼─────────┼─────────┼───────────┼─────────┼────────┤
│ a1b2c3d4-e5f6-7890-abcd-ef1234567890    │ node1 │ sdb  │ -    │ 100 GiB │ 80 GiB  │ 20 GiB    │ 2       │ Ready  │
│ b2c3d4e5-f6a7-8901-bcde-f12345678901    │ node1 │ sdc  │ -    │ 100 GiB │ 100 GiB │ 0 B       │ -       │ Ready  │
│ c3d4e5f6-a7b8-9012-cdef-123456789012    │ node2 │ sdb  │ -    │ 100 GiB │ 50 GiB  │ 50 GiB    │ 5       │ Ready  │
└─────────────────────────────────────────┴───────┴──────┴──────┴─────────┴─────────┴───────────┴─────────┴────────┘
kubectl directpv list drives [DRIVE_ID ...]         \
                             [--all]                \
                             [-d|--drives "string"] \
                             [--labels "string"]    \
                             [-n|--nodes "string"]  \
                             [--status "string"]
  • DRIVE_ID filters output to specific drive IDs.
  • Brackets [] indicate optional parameters.

Aliases

The following aliases have the same function:

  • kubectl directpv list drive
  • kubectl 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:

FlagDescription
--kubeconfigPath to the kubeconfig file to use for CLI requests.
--quietSuppress 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

ColumnDescription
DRIVE IDUnique identifier for the drive
NODEKubernetes node where the drive is located
NAMEDevice name (for example, sdb, nvme0n1)
MAKEDrive manufacturer, if available
SIZETotal drive capacity
FREEAvailable capacity for new volumes
ALLOCATEDCapacity used by existing volumes
VOLUMESNumber of volumes on the drive
STATUSCurrent drive status

Status values

StatusDescription
ReadyDrive is available for volume provisioning
ErrorDrive has encountered an error
LostDrive is no longer accessible
MovingDrive data is being migrated
RemovedDrive has been removed from DirectPV

Additional status flags may appear:

  • SchedulingDisabled - Drive is cordoned and will not receive new volumes
  • Suspended - Drive is suspended for maintenance

On this page