Tucker
Tucker

Reputation: 7362

Copy or clone persistent volume using openshift origin

I have an openshift origin deployment that has a few NFS mounted volumes. I'd like to be able to clone those volumes so i can mount them to other pods and give those other pods write access to that volume without affecting the original volume's data. I don't see that documented clearly anywhere - do people have any ideas?

Upvotes: 2

Views: 2541

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

OpenShift doesn't provide any specific features which will help you with doing that.

You have a few options.

On the NFS server, identify the location of the source volume as well as location used by a target volume, and use normal file system copy mechanisms. Only thing you need to be careful of here, is that if the target volume is being used in a different project, then owner uid on files would need to be changed to uid used by other project.

Alternatively, you claim a persistent volume and mount it into the same pod as the source volume and then use oc rsh to get into the pod and copy the files between the persistent volumes. Then detach the volume and later mount it into the pod you want to have use it. You are restricted to the volume being used in same project doing it this way.

The only other way is to copy the data out of the persistent volume back to your local computer using oc rsync and then copy it back up again into another pod using target volume.

For details on some aspects of copying data around in OpenShift, see the interactive learning scenario on transferring files in and out of containers at:

Upvotes: 3

Related Questions