inode# is different from NTFS FileRef#
Each file is identified by an unique ID in the file system. On linux, this ID "inode number" can be obtained with ls
command. To obtain inode number of "foobar.txt" (that reside at NTFS storage), type as follows:
$ ls -i /media/32C0C7B1C0C77A1D/foobar.txt 35 foobar.txt $
You can see "35" is this file's inode number.
On NTFS, the ID is called File reference number (FileRef#). To obtain FileRef# of "foobar.txt", type as follows:
> fsutil usn readdata f:\foobar.txt Major Version : 0x2 Minor Version : 0x0 FileRef# : 0x0001000000000023 Parent FileRef# : 0x0005000000000005 Usn : 0x0000000000000000 Time Stamp : 0x0000000000000000 0:00:00 1601/01/01 Reason : 0x0 Source Info : 0x0 Security Id : 0x0 File Attributes : 0x20 File Name Length : 0x14 File Name Offset : 0x3c FileName : foobar.txt
You can see "0x0001000000000023" is this file's FileRef#. Same FileRef# value was obtained by using GetFileInformationByHandle()
function:
In addition, I obtained inode number with MSYS's ls command.
> c:\msys\1.0\bin\ls.exe -i f:\foobar.txt 65571 f:\foobar.txt >
I was surprised the inode number obtained by MSYS's ls is different from one obtained by Linux's ls. The above results were summarized as follows:
Type of File ID | Decimal format | Hex format |
---|---|---|
inode# obtained by linux's ls | 35 | 0x00000023 |
inode# obtained by MSYS's ls | 65571 | 0x00010023 |
FileRef# obtained by fsutil command | 281474976710691 | 0x0001000000000023 |
See also
- inode wikipedia
- Fsutil usn
- BY_HANDLE_FILE_INFORMATION Structure - MSDN