57

Does Windows have Inode Numbers like Linux? How does Windows internally manage files?

Lance Roberts
  • 21,279
  • 29
  • 106
  • 128
Gautam Bhalla
  • 1,054
  • 2
  • 10
  • 15

7 Answers7

42

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.

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.

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.

asveikau
  • 35,672
  • 2
  • 48
  • 66
20

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.

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:

https://technet.microsoft.com/en-us/library/cc781134(v=ws.10).aspx

Andrew Howlett
  • 301
  • 2
  • 2
  • 2
    Even on Unix file systems [inode numbers are only unique within a file system](https://stackoverflow.com/q/16069898/995714). [What is a Superblock, Inode, Dentry and a File?](https://unix.stackexchange.com/q/4402/44425) – phuclv Jul 22 '18 at 03:37
19

Yes it does. Generally called fileID. Try this in a Win8 command shell:

fsutil file queryfileid  <filename>
phuclv
  • 27,258
  • 11
  • 104
  • 360
Buai
  • 191
  • 1
  • 2
  • [How to get the File ID of a file or folder in on Windows 10 command line?](https://stackoverflow.com/q/44162664/995714) – phuclv Jul 22 '18 at 03:42
7

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.

All Windows file-systems(FAT*,NTFS) I know of, use Inode-like structures in actual implementation.

To further simplify the answer

(Think of INode as a block of metadata about a file.)

INode as term : No windows file system dont have it.

INode as concept : Windows will have some other structures, similar in property and usage but used with different name

Ajeet Ganga
  • 7,592
  • 10
  • 53
  • 72
  • Wait. How does FAT have an inode-like structure? It doesn't even have hard links; there's no extra layer between file name and data chain. – Mingye Wang Dec 31 '20 at 14:55
5

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.

Rontologist
  • 3,468
  • 1
  • 18
  • 23
-2

No. There is no equivalent to inodes in NTFS. Inode is with **IX based file systems.

But yes, NTFS stores a unique 8-byte reference number for each file.

Comment if you want to know more details.

Gautam Bhalla
  • 1,054
  • 2
  • 10
  • 15
-2

Inodes are a POSIX concept. Modern Windows versions use NTFS. An in-depth description of NTFS: Inside NTFS

Nemanja Trifunovic
  • 23,597
  • 3
  • 46
  • 84
  • 6
    hehe. NO. INode is NOT a Posix concept. Saying that would mean, POSIX came with INode, and others followed it. INode concept came from earliest implementation of non-flat file systems in Unix family. (suffice to say before 1988) POSIX may have defined it in it's own terms later. – Ajeet Ganga Aug 23 '11 at 15:55
  • 8
    @Ajeet: By saying it is a Posix concept, I simply mean it is defined by Posix standard. Of course, inodes predate Posix just as pretty much all other Posix concepts also predate it. – Nemanja Trifunovic Aug 23 '11 at 16:43
  • Where is it defined in the POSIX standard? I've found it in non-normative sections -- but I've yet to find it in other places. – user314104 Jun 17 '14 at 20:43