Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
NTFS
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Hard links === The [[hard link]] feature allows different file names to directly refer to the same file contents. Hard links may link only to files in the same volume, because each volume has its own [[#Master File Table|MFT]]. Hard links were originally included to support the [[POSIX]] subsystem in Windows NT.<ref>{{cite web|title=Chapter 29 β POSIX Compatibility|url=https://learn.microsoft.com/en-us/previous-versions//cc768080(v=technet.10)|work=MS Windows NT Workstation 4.0 Resource Guide|publisher=[[Microsoft]]|access-date=25 January 2025|year=1995}}</ref> Although hard links use the same MFT record ([[inode]]) which records file metadata such as file size, modification date, and attributes, NTFS also caches this data in the directory entry as a performance enhancement. This means that when listing the contents of a directory using FindFirstFile/FindNextFile family of APIs, (equivalent to the POSIX opendir/readdir APIs) you will also receive this cached information, in addition to the name and inode. However, you may not see up-to-date information, as this information is only guaranteed to be updated when a file is closed, and then only for the directory from which the file was opened.<ref>{{cite web|title=Hard Links and Junctions|url=https://learn.microsoft.com/en-us/windows/win32/fileio/hard-links-and-junctions|website=[[Microsoft Learn]]|publisher=[[Microsoft]]|access-date=25 January 2025|date=21 June 2024}}</ref> This means where a file has multiple names via hard links, updating a file via one name does not update the cached data associated with the other name. You can always obtain up-to-date data using GetFileInformationByHandle (which is the true equivalent of POSIX stat function). This can be done using a handle which has no access to the file itself (passing zero to CreateFile for dwDesiredAccess), and closing this handle has the incidental effect of updating the cached information. Windows uses hard links to support [[8.3 filename|short (8.3) filenames]] in NTFS. Operating system support is needed because there are legacy applications that can work only with 8.3 filenames, but support can be disabled. In this case, an additional filename record and directory entry is added, but both 8.3 and long file name are linked and updated together, unlike a regular hard link. The NTFS file system has a limit of 1023 [[hard link]]s on a file.<ref>{{cite web |title=CreateHardLinkA function (winbase.h) |date=June 2023 |url=https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createhardlinka|access-date=25 January 2025}}</ref>{{clarify|is this a limitation of the NTFS on-disk data structure or of Windows NT for all file systems that support hard links?|date=December 2024}}
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
NTFS
(section)
Add topic