I have a very large file (>100GB) on one volume mount in a Docker container. I would like to move it to another volume mount in the same container. However, when I do so using rename, I get the following error: invalid cross-device link
. The code I'm using to do this is the following:
fmt.Printf("Moving %s to %s\n", oo, outputPath)
err = fs.Rename(oo, strings.Replace(oo, inputPath, outputPath, 1))
if err != nil {
fmt.Printf("Error moving %s to %s: %v", oo, outputPath, err)
return
}
I understand why, but what's my alternative? Copying and deleting is really not an option with a file this big. Is there a better way to move across two volumes in a more space efficient way?
The good news is that they’re on the same disk in the underlying container. But the container is extremely locked down, so issuing underlying server commands would not be possible/really hard. That said, we COULD potentially mount them as a unified volume - interesting idea. Is it possible to mount two separate root directives as the same volume?