Difference between HardLink and Copy

O

Oblivion

Hi All...

Can someone explain the difference between creating a Hardlink to a
file and copying the file? They both seem to create a new file that
eats up filesystem space and they both seem to do exactly the same
thing.

I've looked online and cannot find a simple explanation.

Is there any reason to use fsutil hardlink create instead of copy?

Thanks in advance!
 
R

Ramesh, MS-MVP

Hardlink creates a pointer to a file. When you save the file, the changes are applied to the original file. Whereas "copy" creates another copy of the file.

From Microsoft article:

<quote>
A hard link is a file system-level shortcut for a given file. By creating a hard link to an existing file, you duplicate neither the file nor a file-based reference (that is, a shortcut) to it. Instead, you add information to its directory entry at the NTFS level. The physical file remains intact in its original location. Simply put, it now has two or more names that you can use to access the same content!

A hard link saves you from maintaining multiple (but needed) copies of the same file, making the system responsible for managing various path names to address a single physical content. This greatly simplifies your work and saves valuable disk space. Furthermore, hard links, as system-level shortcuts, always point to the right target file-no matter if you rename or move it. Because the link is stored at the file system level, all changes apply automatically and transparently. It's worth noting that hard links must be created within the same NTFS volume. You cannot have a hard link on, say, drive C: pointing to a file on drive D:.
</quote>

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


Hi All...

Can someone explain the difference between creating a Hardlink to a
file and copying the file? They both seem to create a new file that
eats up filesystem space and they both seem to do exactly the same
thing.

I've looked online and cannot find a simple explanation.

Is there any reason to use fsutil hardlink create instead of copy?

Thanks in advance!
 
O

Oblivion

Thanks for your answer! One more question tho - is there a difference
in functionality between XP and Vista? I created Hardlinks to 4
files, each 1GB. When I was done, I had 8 files and each took 1GB.
So it seems like creating a hardlink DOES replicate the file and if
the original files takes 1GB of space, the hardlink does as well
thereby taking 2GB (same as copying).

I thought hardlinks were like shortcuts and only took a few KB. I'm
using Vista.

any thoughts?

Thanks again!
 
O

Oblivion

Ramesh - I answered my own question! Please disregard my last post.
hardlinks don't take up any space but doing a DIR does count the link
as well - hence the confusion on my part.

Thanks for your help sir!
 
R

Ramesh, MS-MVP

You're welcome, Oblivion :)

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com


Ramesh - I answered my own question! Please disregard my last post.
hardlinks don't take up any space but doing a DIR does count the link
as well - hence the confusion on my part.

Thanks for your help sir!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top