硬鏈接(英語:hard link)是計算機文件系統中的多個文件平等地共享同一個文件存儲單元(如MFT條目、inode)。硬鏈接必須在同一個文件系統中;一般用戶權限下的硬鏈接只能用於文件,不能用於目錄,因為其父目錄就有歧義了。刪除一個文件名字後,還可以用其它名字繼續訪問該文件。硬鏈接只能用於同一個文件系統(對於NTFS是限制於同一個分區)。不能用於不存在的文件。[1]
POSIX兼容的操作系統,文件或目錄的硬鏈接的引用計數可以用stat()或fstat()系統調用返回的struct stat
中的st_nlink
字段。
NTFS的硬鏈接
Windows NT 3.1及後續版本支持NTFS硬鏈接。[2] Windows 2000引入了CreateHardLink()
函數以創建硬鏈接,但僅能用於文件,不能用於目錄。[3]DeleteFile()
函數可刪除硬鏈接。
Windows終端用戶創建硬鏈接的方法:
fsutil
工具(Windows 2000引入)[4]mklink
,命令提示字元的內部命令 (Windows Vista和Windows Server 2008引入)[5]New-Item
,PowerShell命令[6]
終端用戶查看文件的硬鏈接的方法:
WinSxS使用硬鏈接跟蹤硬盤上部件的不同版本。
類Unix系統的硬鏈接
用戶創建硬鏈接的方法:
終端用戶查看文件的硬鏈接:
參見
參考文獻
Wikiwand in your browser!
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.