fbpx
维基百科

硬链接

硬链接(英語:hard link)是计算机文件系统中的多个文件平等地共享同一个文件存储单元(如MFT条目inode)。硬链接必须在同一个文件系统中;一般用户权限下的硬链接只能用于文件,不能用于目录,因为其父目录就有歧义了。删除一个文件名字后,还可以用其它名字继续访问该文件。硬链接只能用于同一个文件系统(对于NTFS是限制于同一个分区)。不能用于不存在的文件。[1]

硬链接概念图示

POSIX兼容的操作系统,文件或目录的硬链接的引用计数可以用stat()英语stat (system call)或fstat()系统调用返回的struct stat中的st_nlink字段。

NTFS的硬链接

Windows NT 3.1及后续版本支持NTFS硬链接。[2] Windows 2000引入了CreateHardLink()函数以创建硬链接,但仅能用于文件,不能用于目录。[3]DeleteFile()函数可删除硬链接。

Windows终端用户创建硬链接的方法:

终端用户查看文件的硬链接的方法:

  • fsutil 工具[4]
  • Get-ItemGet-ChildItem,PowerShell命令[7]

WinSxS使用硬链接跟踪硬盘上部件的不同版本。

类Unix系统的硬链接

用户创建硬链接的方法:

  • ln
  • link英语Link (Unix)
  • New-Item,PowerShell的命令[6]

终端用户查看文件的硬链接:

  • stat方法
  • ls -l方法
  • Get-ItemGet-ChildItem,PowerShell命令[7]

参见

  • 符号链接:
  • NTFS符号链接: NTFS支持四种类型的链接—硬链接、符号链接、连接点链接、卷安装点
  • 文件快捷方式:
    • Mac操作系统别名英语alias (Mac OS)
    • OS/2操作系统Shadow英语shadow (OS/2)
  • freedup英语freedupfreedup命令可以释放磁盘空间,通过把冗余的文件用硬链接替代。

参考文献

  1. ^ Pitcher, Lew. Q & A: The difference between hard and soft links. [2021-11-26]. (原始内容于2020-11-12). 
  2. ^ How hard links work. Microsoft Docs. [2021-11-26]. (原始内容于2021-12-05). 
  3. ^ . Windows Development. Microsoft. 10 March 2011. 原始内容存档于2 July 2011 –通过MSDN. Establishes a hard link between an existing file and a new file. This function is only supported on the NTFS file system, and only for files, not directories. 
  4. ^ 4.0 4.1 Fsutil hardlink. Windows App Development. Microsoft. 18 April 2012 [2021-11-26]. (原始内容于2021-11-26) –通过Microsoft Docs. 
  5. ^ Mklink. Microsoft Docs. Microsoft. 18 April 2012 [2021-11-26]. (原始内容于2021-11-26). 
  6. ^ 6.0 6.1 New-Item (PowerShell 3.0). Microsoft Docs. Microsoft. 22 June 2020 [2021-11-26]. (原始内容于2021-11-26). If your location is in a FileSystem drive, the following values are allowed: If your location is in a FileSystem drive, the following values are allowed: File[,] Directory[,] Junction[,] HardLink 
  7. ^ 7.0 7.1 FileSystemProvider.cs. PowerShell / PowerShell repo. Microsoft. Lines 8139–8234. 20 November 2021 [2021-11-26]. (原始内容于2021-11-23) –通过GitHub. 

硬链接, 英語, hard, link, 是计算机文件系统中的多个文件平等地共享同一个文件存储单元, 如mft条目, inode, 必须在同一个文件系统中, 一般用户权限下的只能用于文件, 不能用于目录, 因为其父目录就有歧义了, 删除一个文件名字后, 还可以用其它名字继续访问该文件, 只能用于同一个文件系统, 对于ntfs是限制于同一个分区, 不能用于不存在的文件, 概念图示, posix兼容的操作系统, 文件或目录的的引用计数可以用stat, 英语, stat, system, call, 或fstat, 系统. 硬链接 英語 hard link 是计算机文件系统中的多个文件平等地共享同一个文件存储单元 如MFT条目 inode 硬链接必须在同一个文件系统中 一般用户权限下的硬链接只能用于文件 不能用于目录 因为其父目录就有歧义了 删除一个文件名字后 还可以用其它名字继续访问该文件 硬链接只能用于同一个文件系统 对于NTFS是限制于同一个分区 不能用于不存在的文件 1 硬链接概念图示 POSIX兼容的操作系统 文件或目录的硬链接的引用计数可以用stat 英语 stat system call 或fstat 系统调用返回的struct stat中的st nlink字段 目录 1 NTFS的硬链接 2 类Unix系统的硬链接 3 参见 4 参考文献NTFS的硬链接 编辑Windows NT 3 1及后续版本支持NTFS硬链接 2 Windows 2000引入了CreateHardLink 函数以创建硬链接 但仅能用于文件 不能用于目录 3 DeleteFile 函数可删除硬链接 Windows终端用户创建硬链接的方法 fsutil工具 Windows 2000引入 4 mklink Windows Command Prompt的内部命令 Windows Vista和Windows Server 2008引入 5 New Item PowerShell命令 6 终端用户查看文件的硬链接的方法 fsutil 工具 4 Get Item与Get ChildItem PowerShell命令 7 WinSxS使用硬链接跟踪硬盘上部件的不同版本 类Unix系统的硬链接 编辑用户创建硬链接的方法 ln link 英语 Link Unix New Item PowerShell的命令 6 终端用户查看文件的硬链接 a href Stat Unix html title Stat Unix stat a 方法 a href Ls html title Ls ls a l方法 Get Item与Get ChildItem PowerShell命令 7 参见 编辑符号链接 NTFS符号链接 NTFS支持四种类型的链接 硬链接 符号链接 连接点链接 卷安装点 文件快捷方式 Mac操作系统别名 英语 alias Mac OS OS 2操作系统Shadow 英语 shadow OS 2 freedup 英语 freedup freedup命令可以释放磁盘空间 通过把冗余的文件用硬链接替代 参考文献 编辑 Pitcher Lew Q amp A The difference between hard and soft links 2021 11 26 原始内容存档于2020 11 12 How hard links work Microsoft Docs 2021 11 26 原始内容存档于2021 12 05 CreateHardLink Function Windows Development Microsoft 10 March 2011 原始内容存档于2 July 2011 通过MSDN Establishes a hard link between an existing file and a new file This function is only supported on the NTFS file system and only for files not directories 4 0 4 1 Fsutil hardlink Windows App Development Microsoft 18 April 2012 2021 11 26 原始内容存档于2021 11 26 通过Microsoft Docs Mklink Microsoft Docs Microsoft 18 April 2012 2021 11 26 原始内容存档于2021 11 26 6 0 6 1 New Item PowerShell 3 0 Microsoft Docs Microsoft 22 June 2020 2021 11 26 原始内容存档于2021 11 26 If your location is in a FileSystem drive the following values are allowed If your location is in a FileSystem drive the following values are allowed File Directory Junction HardLink 7 0 7 1 FileSystemProvider cs PowerShell PowerShell repo Microsoft Lines 8139 8234 20 November 2021 2021 11 26 原始内容存档于2021 11 23 通过GitHub 取自 https zh wikipedia org w index php title 硬链接 amp oldid 69765278, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。