CLI Reference

Prerequisites

The DirectPV commands rely on the Kubernetes command line tool, kubectl. To install kubectl on your system, see the Kubernetes documentation.

Install DirectPV plugin

DirectPV provides a kubectl plugin for managing DirectPV drives and volumes. Use this plugin at the command line to complete all of the functions required for adding, managing, scheduling, and removing DirectPV-managed drives and volumes in a Kubernetes cluster.

Install the directpv plugin by downloading the binary for your specific architecture and moving it to the /usr/local/bin folder on your local machine:

AMD64

curl --retry 10 --progress-bar -L https://dl.min.io/aistor/directpv/release/linux-amd64/kubectl-directpv -o kubectl-directpv

chmod +x ./kubectl-directpv
sudo mv ./kubectl-directpv /usr/local/bin/kubectl-directpv

kubectl directpv --help

ARM64

curl --retry 10 --progress-bar -L https://dl.min.io/aistor/directpv/release/linux-arm64/kubectl-directpv -o kubectl-directpv

chmod +x ./kubectl-directpv
sudo mv ./kubectl-directpv /usr/local/bin/kubectl-directpv

kubectl directpv --help

PPC64-LE

curl --retry 10 --progress-bar -L https://dl.min.io/aistor/directpv/release/linux-ppc64le/kubectl-directpv -o kubectl-directpv

chmod +x ./kubectl-directpv
sudo mv ./kubectl-directpv /usr/local/bin/kubectl-directpv

kubectl directpv --help

AMD64

curl --retry 10 --progress-bar -L https://dl.min.io/aistor/directpv/release/darwin-amd64/kubectl-directpv -o kubectl-directpv

chmod +x ./kubectl-directpv
sudo mv ./kubectl-directpv /usr/local/bin/kubectl-directpv

kubectl directpv --help

ARM64

curl --retry 10 --progress-bar -L https://dl.min.io/aistor/directpv/release/darwin-arm64/kubectl-directpv -o kubectl-directpv

chmod +x ./kubectl-directpv
sudo mv ./kubectl-directpv /usr/local/bin/kubectl-directpv

kubectl directpv --help
Invoke-WebRequest https://dl.min.io/aistor/directpv/release/windows-amd64/kubectl-directpv.exe -OutFile C:\kubectl-directpv.exe

C:\kubectl-directpv.exe --help

Usage

kubectl directpv [command] [flags]

Flags

The following flags are available for kubectl directpv and many of the commands included with the plugin.

FlagDescription
-h, --helpDisplay help for DirectPV.
--kubeconfig stringPath to the kubeconfig file to use for CLI requests.
--quietSuppress printing error messages.
--versionDisplay the DirectPV version.

Ellipsis expansion notation

Many DirectPV commands support ellipsis expansion notation for specifying ranges of nodes or drives. This allows you to target multiple resources with a single pattern instead of listing each one individually.

Use three dots (...) between the start and end values inside curly braces:

PatternExpands to
node{1...4}node1, node2, node3, node4
sd{a...d}sda, sdb, sdc, sdd
nvme{0...2}n1nvme0n1, nvme1n1, nvme2n1

Example: List drives sda through sdf on nodes node1 through node4:

kubectl directpv list drives --nodes=node{1...4} --drives=sd{a...f}

Resource selection

Many DirectPV commands operate on drives or volumes that you select using flags or arguments. These commands require at least one selection method to prevent accidental operations on unintended resources.

Selection methods

Commands typically support one or more of the following selection methods:

MethodDescription
Resource ID argumentSpecify one or more drive or volume IDs directly as arguments
--allSelect all matching resources
--nodesSelect resources on specific nodes
--drivesSelect resources on drives with specific names
--drive-idSelect resources on drives with specific IDs
--statusSelect resources with a specific status
--labelsSelect resources with specific labels
--pod-namesSelect volumes associated with specific pods
--pod-namespacesSelect volumes in specific namespaces

Not every command supports all flags. See individual command documentation for supported selection methods.

Selection behavior

  • If you do not specify a selection method, the command returns an error.
  • When you specify --all, DirectPV ignores other selection flags.
  • You can combine multiple selection flags to narrow results (for example, --nodes=node1 --drives=sda). DirectPV only selects resources that match all selection flags, using AND logic.

Available commands

This documentation includes details for each available command on separate subpages. The available commands include:

Cluster commands

CommandDescription
installInstall DirectPV in Kubernetes
discoverProbe nodes for available drives and generate a configuration file
initFormat and initialize drives for DirectPV management
infoShow information about DirectPV installation
uninstallUninstall DirectPV from Kubernetes

Drive commands

CommandDescription
label drivesAdd, update, or remove labels on drives for scheduling
list drivesDisplay drive status, capacity, and volume information
repairRepair XFS filesystem errors on drives
resume drivesResume suspended drives to restore normal operation
suspend drivesSuspend drives for maintenance (mounts volumes read-only)

Maintenance commands

CommandDescription
cleanRemove stale volumes in released or deleted status
moveMove volume metadata from source drive to destination drive on the same node
removeRemove unused drives from DirectPV

Scheduling commands

CommandDescription
cordonPrevent new volumes on drives
uncordonAllow new volumes on drives

Volume commands

CommandDescription
list volumesDisplay volume status, capacity, and pod assignments
label volumesAdd, update, or remove labels on volumes
suspend volumesSuspend volumes for maintenance (mounts read-only)
resume volumesResume suspended volumes to restore normal operation

Command history

Deprecated commands

The following commands have been removed from DirectPV. See Deprecated Commands for historical reference.

CommandRemoved inReason
migrateDirectPV 5.1.0Legacy DirectCSI migration support removed

Command changes from DirectCSI

DirectCSI commandDirectPV command
kubectl directcsi drives listkubectl directpv list drives
kubectl directcsi volumes listkubectl directpv list volumes
kubectl directcsi formatkubectl directpv discover, then kubectl directpv init

On this page