et's compare to the two operations. First, copying a file from one partition to another:
The source is opened.
The destination is opened/created.
Space is allocated for the destination.
Every byte of file data is read from the source and written to the destination.
The destination file is closed.
The source file handle is set to unlink on close.
The source file handle is closed, unlinking the file.
Since that is (typically) the last reference to the source file data, the source file data has to be made free.
Now, copying a file from one folder to another on the same partition.
The source is opened.
A new hard link is created to the source file in the destination directory.
The handle to the source file is set to unlink on close.
The source handle is closed, unlinking it. The source file is still linked to the destination directory, so no free space needs to be changed.
Comments
Post a Comment