docker – Move files from one volume bind to another

Ulrar asked:

I have some docker containers with volumes bound to directories on the host, all on the same hard drive.
But from example when I run mv /input/test /output/test, where input and output are both bolumes bound to directories on the same hard drive, it takes forever as if they were on different drives. I can see huge spikes of read / write on my hard drive too.

Is there a way to have mv behave in docker as if it was running on the host (maybe some option to docker run), actually moving the file instead of copying then deleting the original ?

Thanks

My answer:


Put both directories in a single volume.

From the perspective of the container the two volumes are distinct filesystems. It must copy from one to the other. There is no way to know that they have the same backing store.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.