Under following conditions-
mvwithin the same HDD partitionmvto a different partition in the same HDDmvto a different device (e.g. USB HDD)
Is the complete file moved or is it a very small change like some pointer reassignment ?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
It’s up to each filesystem how to handle a move within the filesystem (also known as renaming a file), but filesystems pretty much universally handle it by updating directory entries without moving the inode or file contents.
A move between filesystems (it doesn’t matter if it’s on the same physical medium or not) is handled as a file copy followed by a delete. This is in fact exactly what the mv command does. Obviously that means that the destination filesystem has to make a new copy of the file.
Method 2
man mv says:
As the rename(2) call does not work across file systems, mv uses cp(1) and rm(1) to
accomplish the move. The effect is equivalent to:
rm -f destination_path &&
cp -pRP source_file destination &&
rm -rf source_file
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0