Linux Tip of the Day - Why mv is slow

March 2, 2008 by Adrian
Filed under: Linux 

mv command across filesystems is slower on large files

 

WHY?

 

mv would be slow if you are moving files across filesystem.

 

The inode number changes only when a file is moved across file system.

 

A new inode number means a new file is physically created on disk.

 

It remains unchanged, if it is within the same filesystem. One can verify by using ls -il command on that file.

 

mv uses rename() system call. if it fails, it uses copy routine (basicailly reads from a file and writes in another file).

 

mv command across filesystem is more of a copy then mv.

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!