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 ?


1 Answer 1


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.

  • Thanks, I did that. Not ideal, since this is all going through the same kernel I would have expected it to be smart enough to not do a full copy, but oh well
    – Ulrar
    Nov 24, 2020 at 20:00
  • @Ulrar Such knowledge would violate the security that the mount namespace provides. Nov 24, 2020 at 20:07
  • Right, that's fine, I don't mind. Would have been a nice option to have with the dozens of other capabilities
    – Ulrar
    Nov 24, 2020 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .