CLI tool to easily migrate or backup/restore Kubernetes persistent volumes
CLI tool to easily migrate or backup/restore Kubernetes persistent volumes
pv-migrate is a CLI tool and kubectl plugin that moves the data of Kubernetes PersistentVolumeClaims.
It copies directly from one PVC to another, in the same namespace, across namespaces or across clusters.
It can also back up a PVC to bucket storage (S3-compatible, Azure Blob, GCS or any rclone remote) and restore it later.
[!WARNING] Heads up: this is a side project I maintain in my spare time. I might take a long time to look at issues or PRs, or not get to them at all. Sorry in advance, and thanks for understanding.
Copying a claim into another one:
When a migration fails, the output explains why:
On Kubernetes, renaming a resource like a Deployment is a manifest change.
You create the same object with a new name or namespace, apply it, and move on.
PVCs are different. The Kubernetes object is only the metadata. The data lives in the storage backend, and there is no built-in way to move it.
pv-migrate moves that data.
It runs a proven data mover (rsync or rclone) inside the cluster, so nothing is copied through your machine unless you ask for it.
pv-migrate --source old-pvc --dest new-pvcThis copies the contents of old-pvc into new-pvc in the current namespace, trying the cheapest strategy first.
See Installation for how to get the binary, and Usage for everything else.
Copies data directly from one PVC to another with rsync, usually over SSH. This is the original workflow.
pv-migrate --source old-pvc --dest new-pvcSee PVC-to-PVC migration for the strategies and more examples.
Backs up a PVC to object storage with rclone and restores it later. Use it for backups, one-off exports, or moves where direct connectivity between the clusters is not available.
pv-migrate backup \
--source app-data \
--backend s3 \
--bucket pv-backups \
--name app-data-2026-04-11
pv-migrate restore \
--dest app-data-restore \
--backend s3 \
--bucket pv-backups \
--name app-data-2026-04-11See Bucket backup and restore for the backends, the object layout, raw rclone config mode and the permission caveats.
50Gi PVC and needs more space, but the storage class does not support volume expansion.
Create a bigger PVC and copy the data over.ns-a to namespace ns-b.
Create the PVC with the same manifest in ns-b and copy its content.pv-migrate copies it over the internet, encrypted with SSH.StorageClass, e.g., from a ReadWriteOnce one like local-path to a ReadWriteMany one like NFS.
The storage class is not editable, so create the new PVC and copy.pv-migrate backup writes it to a bucket, pv-migrate restore brings it back.pv-migrate backup from a CronJob, and handle retention with bucket lifecycle rules.mount)ClusterIP service (clusterip)LoadBalancer service (loadbalancer)NodePort service (nodeport, opt-in)local, opt-in)--rsync-push) for when the source side cannot expose a service, e.g., behind a firewall or NAT--detach) for large transfers, so the job keeps running after the CLI exitsSee docs/install.md for the install options (Homebrew, krew, Scoop, release archives, Docker) and shell completion. The shortest one:
brew install utkuozdemir/pv-migrate/pv-migrateThe artifacts live here:
pv-migrate-rsync, pv-migrate-sshd, pv-migrate-rclone)Releases are signed, and the install guide has the verification commands.
See docs/usage.md for the usage guides and the command reference:
See CONTRIBUTING.md for the process, .github/SECURITY.md for reporting a security problem, and .github/GOVERNANCE.md for how the project is run. The security model says what the tool promises and where the trust boundaries are, and the roadmap says what is planned and what is deliberately not.
AGENTS.md is the project guide for humans and AI assistants working in this repository: how the pieces fit together, and which invariants are easy to break by accident.
No open issues yet, or sync has not completed.