Windows 有像 Linux 一样的 Inode 编号吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7162164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does Windows have Inode Numbers like Linux?
提问by Gautam Bhalla
Does Windows have Inode Numbers like Linux? How does Windows internally manage files?
Windows 有像 Linux 一样的 Inode 编号吗?Windows 内部如何管理文件?
回答by Rontologist
This question is more about filesystems than a particular OS I believe. Each filesystem handles files differently (and each OS can support multiple filesystems).
这个问题更多地是关于文件系统而不是我认为的特定操作系统。每个文件系统以不同的方式处理文件(每个操作系统都可以支持多个文件系统)。
http://pcnineoneone.com/howto/filesystems1/has a pretty good writeup on FAT and NTFS, which are two popular filesystems with windows.
http://pcnineoneone.com/howto/filesystems1/有一篇关于 FAT 和 NTFS 的相当不错的文章,这是两个流行的 Windows 文件系统。
回答by Nemanja Trifunovic
Inodes are a POSIX concept. Modern Windows versions use NTFS. An in-depth description of NTFS: Inside NTFS
inode 是一个 POSIX 概念。现代 Windows 版本使用 NTFS。NTFS 的深入描述:Inside NTFS
回答by asveikau
The terminology used is a bit different from what you'd find in the Unix world, however in terms of having an integer that uniquely identifies a file, NTFS and some Windows API expose the concept of "file IDs" which is similar.
使用的术语与您在 Unix 世界中找到的术语略有不同,但是就具有唯一标识文件的整数而言,NTFS 和某些 Windows API 公开了类似的“文件 ID”概念。
You can query the file ID of an open handle via GetFileInformationByHandle
. See nFileIndexHigh
, nFileIndexLow
; this is the high and low parts respectively of the file ID which is 64 bits.
您可以通过 查询打开句柄的文件 ID GetFileInformationByHandle
。见nFileIndexHigh
, nFileIndexLow
; 这是文件 ID 的高低部分,分别为 64 位。
NtCreateFile
can also open a file by its ID. See the FILE_OPEN_BY_FILE_ID
flag. You need a volume handle to open by file ID.
NtCreateFile
也可以通过文件 ID 打开文件。见FILE_OPEN_BY_FILE_ID
旗。您需要一个卷句柄才能按文件 ID 打开。
回答by Ajeet Ganga
There are two things here. The term INode, and a file-system implementation that uses either INode terminology or something like INode in its place.
这里有两件事。术语 INode,以及一个文件系统实现,它使用 INode 术语或类似 INode 的术语来代替。
All Windows file-systems(FAT*,NTFS) I know of, use Inode-like structures in actual implementation.
我所知道的所有 Windows 文件系统(FAT*、NTFS),在实际实现中都使用类似 Inode 的结构。
To further simplify the answer
为了进一步简化答案
(Think of INode as a block of metadata about a file.)
(将 INode 视为有关文件的元数据块。)
INode as term : No windows file system dont have it.
INode 作为术语:没有 Windows 文件系统没有它。
INode as concept : Windows will have some other structures, similar in property and usage but used with different name
INode 作为概念:Windows 将有一些其他结构,在属性和用法上相似,但使用不同的名称
回答by Gautam Bhalla
NO,There is no equivalent to inode in windows NTFS.Inode is more of with **IX based file systems.
不,在 Windows NTFS 中没有与 inode 等效的东西。inode 更像是基于 **IX 的文件系统。
But yes,NTFS stores a unique 8-byte reference number for each file.
但是是的,NTFS 为每个文件存储一个唯一的 8 字节参考号。
cheers .Comment if you wanna know more details
干杯。如果您想了解更多详细信息,请发表评论
回答by Andrew Howlett
Yes. NTFS uses a B-Tree indexing system. Every file in the MFT has a 64 bit File Index Number. This number, called the File ID, uniquely identifies the file ONLY WITHIN ITS VOLUME. I.e., two files on two separate volumes on the same PC may have the same File ID. See this MSDN article for more details.
是的。NTFS 使用 B 树索引系统。MFT 中的每个文件都有一个 64 位的文件索引号。此编号称为文件 ID,仅在其卷内唯一标识文件。即,同一 PC 上两个不同卷上的两个文件可能具有相同的文件 ID。有关更多详细信息,请参阅此 MSDN 文章。
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788(v=vs.85).aspx
regarding your second question, "how does windows internally manage files", see this technet article:
关于您的第二个问题,“Windows 如何在内部管理文件”,请参阅此技术网文章:
https://technet.microsoft.com/en-us/library/cc781134(v=ws.10).aspx
https://technet.microsoft.com/en-us/library/cc781134(v=ws.10).aspx
回答by Buai
Yes it does. Generally called fileID
. Try this in a Win8 command shell:
是的,它确实。一般称为fileID
. 在 Win8 命令外壳中试试这个:
fsutil file queryfileid <filename>