kubectl directpv move

The kubectl directpv move command moves volume metadata from a source drive to a destination drive on the same node. Use this command as part of a drive replacement workflow.

Data not copied
This command moves volume metadata only. It does not copy the actual data stored on the volumes. Use this command only when the source drive data has already been copied or is no longer needed.

Syntax

Aliases

You can use mv as an alias for move:

kubectl directpv mv SRC_DRIVE DEST_DRIVE

Parameters

SRC_DRIVE

Required

The drive ID of the source drive containing the volumes to move. Use kubectl directpv list drives to find drive IDs.

DEST_DRIVE

Required

The drive ID of the destination drive where volumes will be moved. The destination drive must be on the same node as the source drive. Use kubectl directpv list drives to verify both drives are on the same node by checking the NODE column in the output.

--skip-thin-provisioning

Optional

Use thick provisioning for volumes on the destination drive. By default, DirectPV uses thin provisioning.

With thin provisioning, DirectPV allocates physical storage space only as data is written, allowing volumes to share available capacity. With thick provisioning, DirectPV reserves the full requested capacity for each volume immediately, guaranteeing that space is available but requiring more upfront storage.

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

Move volumes between drives

Move all volumes from source drive to destination drive:

kubectl directpv move af3b8b4c-73b4-4a74-84b7-1ec30492a6f0 834e8f4c-14f4-49b9-9b77-e8ac854108d5

Move volumes with thick provisioning

Move volumes and reserve full capacity on the destination:

kubectl directpv move af3b8b4c-73b4-4a74-84b7-1ec30492a6f0 834e8f4c-14f4-49b9-9b77-e8ac854108d5 --skip-thin-provisioning

Behavior

What the move command does

The move command:

  1. Transfers volume metadata from the source drive to the destination drive.
  2. Updates volume references to point to the new drive.
  3. Does not copy actual data from the source to the destination.

Requirements

  • Both drives must be on the same node.
  • The destination drive must have sufficient capacity for the volumes.
  • The source drive should be cordoned or suspended before moving volumes.

Typical drive replacement workflow

When replacing a failed or failing drive:

  1. Cordon the source drive to prevent new volumes:

    kubectl directpv cordon --drives=sda --nodes=node1
    
  2. Copy data from the source drive to the destination drive (outside of DirectPV).

  3. Move volume metadata to the new drive:

    kubectl directpv move <source-drive-id> <dest-drive-id>
    
  4. Remove the old drive from DirectPV:

    kubectl directpv remove <source-drive-id>
    

Thin vs thick provisioning

  • Thin provisioning (default): Space is allocated as data is written. Volumes may overcommit drive capacity.
  • Thick provisioning (--skip-thin-provisioning): Full requested capacity is reserved immediately. Prevents overcommitment but requires more upfront space.