8

Given:

# mv /mnt/hard/git-src/ /usr/portage/distfiles/

mv: inter-device move failed: /mnt/hard/git-src/' to /usr/portage/distfiles/git-src'; unable to remove target: Is a directory

And

cd /tmp; mkdir a b; mdkir a/c b/c;

touch a/c/1 b/c/1

mv a/c b/ mv: cannot move a/c' tob/c': File exists

rm a/c/1 b/c/1

mv a/c b/

So moving a dir to a dir with same name, when they contain similar files, is 'File exists'. What's the point of tagging it 'inter-device move' when using different partitions?

1

1 Answer 1

11

mv on the same filesystem means moving a single directory entry from one directory to another. mv across filesystems means copying the whole source tree and removing source files after they have been copied. The algorithm and code are different in the two cases, as are many of the failure modes, so mv makes it clear in its error message when it does a cross-filesystem move.

(Here, on the same filesystem, it is a rename system call that returns an error. For a cross-filesystem move, it's an mkdir call, as part of the recreation of the directory tree.)

You must log in to answer this question.

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