FSU

The NTFS Filesystem

NTFS stands for "New Technologies Filesystem". It came out with Windows NT, and in many ways, it is a unique filesystem.

Like FAT, NTFS has gone through a number of generations. Unfortunately, Microsoft has never been as open about NTFS, and we are often left guessing as to the whys and whats of the changes that we do detect.

One of the more unusual aspects of dealing with NTFS is that it has a rather unique recursive model, and the base case is not always clear. We will look at more on that quirk as we examine NTFS.

As with FAT, an excellent source of information is FSFA pp. 273-396 (about 1/4 of the whole book!) Also, the Wiki page on NTFS is generally quite good.

Everything is a file (sort of)

NTFS uses a generic wrapper technique to isolate the specifics of implementation. This allows some neat tricks.

Self-referentially, NTFS actually stores metadata about the filesystem inside of files. It does by creating 12 special files to hold this data. We can literally see the Master File Table entries (as FSFA terms them; Microsoft actually calls them file records) for these in a dump of an otherwise empty NTFS filesystem:

0004000: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0004010: 0100 0100 3800 0100 9801 0000 0004 0000  ....8...........
0004020: 0000 0000 0000 0000 0400 0000 0000 0000  ................
0004030: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0004040: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0004050: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004060: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004070: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0004080: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0004090: 0000 0000 0000 0000 3000 0000 6800 0000  ........0...h...
00040a0: 0000 1800 0000 0200 4a00 0000 1800 0100  ........J.......
00040b0: 0500 0000 0000 0500 80d2 9f44 98fe cb01  ...........D....
00040c0: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
00040d0: 80d2 9f44 98fe cb01 006c 0000 0000 0000  ...D.....l......
00040e0: 006c 0000 0000 0000 0600 0000 0000 0000  .l..............
00040f0: 0403 2400 4d00 4600 5400 0000 0000 0000  ..$.M.F.T.......
0004100: 8000 0000 4800 0000 0100 4000 0000 0100  ....H.....@.....
0004110: 0000 0000 0000 0000 0600 0000 0000 0000  ................
0004120: 4000 0000 0000 0000 0070 0000 0000 0000  @........p......
0004130: 006c 0000 0000 0000 006c 0000 0000 0000  .l.......l......
0004140: 1107 0400 0000 0000 b000 0000 4800 0000  ............H...
0004150: 0100 4000 0000 0300 0000 0000 0000 0000  ..@.............
0004160: 0000 0000 0000 0000 4000 0000 0000 0000  ........@.......
0004170: 0010 0000 0000 0000 0800 0000 0000 0000  ................
0004180: 0800 0000 0000 0000 1101 0200 0000 0000  ................
0004190: ffff ffff 0000 0000 0000 0000 0000 0000  ................
00041a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00041f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00043f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004400: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0004410: 0100 0100 3800 0100 5801 0000 0004 0000  ....8...X.......
0004420: 0000 0000 0000 0000 0300 0000 0100 0000  ................
0004430: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0004440: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0004450: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004460: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004470: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0004480: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0004490: 0000 0000 0000 0000 3000 0000 7000 0000  ........0...p...
00044a0: 0000 1800 0000 0200 5200 0000 1800 0100  ........R.......
00044b0: 0500 0000 0000 0500 80d2 9f44 98fe cb01  ...........D....
00044c0: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
00044d0: 80d2 9f44 98fe cb01 0010 0000 0000 0000  ...D............
00044e0: 0010 0000 0000 0000 0600 0000 0000 0000  ................
00044f0: 0803 2400 4d00 4600 5400 4d00 6900 7200  ..$.M.F.T.M.i.r.
0004500: 7200 0000 0000 0000 8000 0000 4800 0000  r...........H...
0004510: 0100 4000 0000 0100 0000 0000 0000 0000  ..@.............
0004520: 0000 0000 0000 0000 4000 0000 0000 0000  ........@.......
0004530: 0010 0000 0000 0000 0010 0000 0000 0000  ................
0004540: 0010 0000 0000 0000 3101 ffc1 0300 0000  ........1.......
0004550: ffff ffff 0000 0000 0000 0000 0000 0000  ................
0004560: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00045f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004600: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00047f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004800: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0004810: 0200 0100 3800 0100 5801 0000 0004 0000  ....8...X.......
0004820: 0000 0000 0000 0000 0300 0000 0200 0000  ................
0004830: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0004840: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0004850: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004860: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004870: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0004880: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0004890: 0000 0000 0000 0000 3000 0000 7000 0000  ........0...p...
00048a0: 0000 1800 0000 0200 5200 0000 1800 0100  ........R.......
00048b0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
00048c0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00048d0: 80ff d045 98fe cb01 00e0 9900 0000 0000  ...E............
00048e0: 00e0 9900 0000 0000 0600 0000 0000 0000  ................
00048f0: 0803 2400 4c00 6f00 6700 4600 6900 6c00  ..$.L.o.g.F.i.l.
0004900: 6500 0000 0000 0000 8000 0000 4800 0000  e...........H...
0004910: 0100 4000 0000 0100 0000 0000 0000 0000  ..@.............
0004920: 9d09 0000 0000 0000 4000 0000 0000 0000  ........@.......
0004930: 00e0 9900 0000 0000 00e0 9900 0000 0000  ................
0004940: 00e0 9900 0000 0000 329e 0900 c203 0000  ........2.......
0004950: ffff ffff 0000 0000 0000 0000 0000 0000  ................
0004960: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00049f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004a00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0004bf0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004c00: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0004c10: 0300 0100 3800 0100 f001 0000 0004 0000  ....8...........
0004c20: 0000 0000 0000 0000 0700 0000 0300 0000  ................
0004c30: 0200 0000 0000 0000 1000 0000 4800 0000  ............H...
0004c40: 0000 1800 0000 0000 3000 0000 1800 0000  ........0.......
0004c50: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004c60: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0004c70: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0004c80: 3000 0000 6800 0000 0000 1800 0000 0100  0...h...........
0004c90: 5000 0000 1800 0100 0500 0000 0000 0500  P...............
0004ca0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0004cb0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0004cc0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0004cd0: 0600 0000 0000 0000 0703 2400 5600 6f00  ..........$.V.o.
0004ce0: 6c00 7500 6d00 6500 4000 0000 2800 0000  l.u.m.e.@...(...
0004cf0: 0000 0000 0000 0600 1000 0000 1800 0000  ................
0004d00: b776 3da4 b862 40b0 be19 e316 b8a9 6657  .v=..b@.......fW
0004d10: 5000 0000 8000 0000 0000 1800 0000 0200  P...............
0004d20: 6400 0000 1800 0000 0100 0480 4800 0000  d...........H...
0004d30: 5400 0000 0000 0000 1400 0000 0200 3400  T.............4.
0004d40: 0200 0000 0000 1400 9f01 1200 0101 0000  ................
0004d50: 0000 0005 1200 0000 0000 1800 9f01 1200  ................
0004d60: 0102 0000 0000 0005 2000 0000 2002 0000  ........ ... ...
0004d70: 0101 0000 0000 0005 1200 0000 0102 0000  ................
0004d80: 0000 0005 2000 0000 2002 0000 0000 0000  .... ... .......
0004d90: 6000 0000 1800 0000 0000 1800 0000 0400  `...............
0004da0: 0000 0000 1800 0000 7000 0000 2800 0000  ........p...(...
0004db0: 0000 1800 0000 0500 0c00 0000 1800 0000  ................
0004dc0: 0000 0000 0000 0000 0301 0000 0000 0000  ................
0004dd0: 8000 0000 1800 0000 0000 1800 0000 0300  ................
0004de0: 0000 0000 1800 0000 ffff ffff 0000 0000  ................
0004df0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0004e00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0004ff0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005000: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0005010: 0400 0100 3800 0100 c001 0000 0004 0000  ....8...........
0005020: 0000 0000 0000 0000 0400 0000 0400 0000  ................
0005030: 0200 0000 0000 0000 1000 0000 4800 0000  ............H...
0005040: 0000 1800 0000 0000 3000 0000 1800 0000  ........0.......
0005050: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005060: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005070: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0005080: 3000 0000 7000 0000 0000 1800 0000 0200  0...p...........
0005090: 5200 0000 1800 0100 0500 0000 0000 0500  R...............
00050a0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00050b0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00050c0: 0010 0000 0000 0000 000a 0000 0000 0000  ................
00050d0: 0600 0000 0000 0000 0803 2400 4100 7400  ..........$.A.t.
00050e0: 7400 7200 4400 6500 6600 0000 0000 0000  t.r.D.e.f.......
00050f0: 5000 0000 8000 0000 0000 1800 0000 0300  P...............
0005100: 6400 0000 1800 0000 0100 0480 4800 0000  d...........H...
0005110: 5400 0000 0000 0000 1400 0000 0200 3400  T.............4.
0005120: 0200 0000 0000 1400 8900 1200 0101 0000  ................
0005130: 0000 0005 1200 0000 0000 1800 8900 1200  ................
0005140: 0102 0000 0000 0005 2000 0000 2002 0000  ........ ... ...
0005150: 0101 0000 0000 0005 1200 0000 0102 0000  ................
0005160: 0000 0005 2000 0000 2002 0000 0000 0000  .... ... .......
0005170: 8000 0000 4800 0000 0100 4000 0000 0100  ....H.....@.....
0005180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0005190: 4000 0000 0000 0000 0010 0000 0000 0000  @...............
00051a0: 000a 0000 0000 0000 000a 0000 0000 0000  ................
00051b0: 3101 86f0 0000 0000 ffff ffff 0000 0000  1...............
00051c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00051f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00053f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005400: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0005410: 0500 0100 3800 0300 0002 0000 0004 0000  ....8...........
0005420: 0000 0000 0000 0000 0600 0000 0500 0000  ................
0005430: 0200 0000 0000 0000 1000 0000 4800 0000  ............H...
0005440: 0000 1800 0000 0000 3000 0000 1800 0000  ........0.......
0005450: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005460: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005470: 2600 0000 0000 0000 0000 0000 0000 0000  &...............
0005480: 3000 0000 6000 0000 0000 1800 0000 0100  0...`...........
0005490: 4400 0000 1800 0100 0500 0000 0000 0500  D...............
00054a0: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
00054b0: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
00054c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00054d0: 0600 0010 0000 0000 0103 2e00 0000 0000  ................
00054e0: 5000 0000 4800 0000 0100 4000 0000 0200  P...H.....@.....
00054f0: 0000 0000 0000 0000 0100 0000 0000 0000  ................
0005500: 4000 0000 0000 0000 0020 0000 0000 0000  @........ ......
0005510: 2c10 0000 0000 0000 2c10 0000 0000 0000  ,.......,.......
0005520: 3102 83f0 0000 0000 9000 0000 5800 0000  1...........X...
0005530: 0004 1800 0000 0300 3800 0000 2000 0000  ........8... ...
0005540: 2400 4900 3300 3000 3000 0000 0100 0000  $.I.3.0.0.......
0005550: 0010 0000 0100 0000 1000 0000 2800 0000  ............(...
0005560: 2800 0000 0100 0000 0000 0000 0000 0000  (...............
0005570: 1800 0000 0300 0000 0000 0000 0000 0000  ................
0005580: a000 0000 5000 0000 0104 4000 0000 0500  ....P.....@.....
0005590: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00055a0: 4800 0000 0000 0000 0010 0000 0000 0000  H...............
00055b0: 0010 0000 0000 0000 0010 0000 0000 0000  ................
00055c0: 2400 4900 3300 3000 3101 85f0 0000 0000  $.I.3.0.1.......
00055d0: b000 0000 2800 0000 0004 1800 0000 0400  ....(...........
00055e0: 0800 0000 2000 0000 2400 4900 3300 3000  .... ...$.I.3.0.
00055f0: 0100 0000 0000 0000 ffff ffff 0000 0200  ................
0005600: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00057f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005800: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0005810: 0600 0100 3800 0100 5001 0000 0004 0000  ....8...P.......
0005820: 0000 0000 0000 0000 0300 0000 0600 0000  ................
0005830: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0005840: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0005850: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005860: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005870: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0005880: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0005890: 0000 0000 0000 0000 3000 0000 6800 0000  ........0...h...
00058a0: 0000 1800 0000 0200 5000 0000 1800 0100  ........P.......
00058b0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
00058c0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00058d0: 80ff d045 98fe cb01 0000 0100 0000 0000  ...E............
00058e0: 80f0 0000 0000 0000 0600 0000 0000 0000  ................
00058f0: 0703 2400 4200 6900 7400 6d00 6100 7000  ..$.B.i.t.m.a.p.
0005900: 8000 0000 4800 0000 0100 4000 0000 0100  ....H.....@.....
0005910: 0000 0000 0000 0000 0f00 0000 0000 0000  ................
0005920: 4000 0000 0000 0000 0000 0100 0000 0000  @...............
0005930: 80f0 0000 0000 0000 80f0 0000 0000 0000  ................
0005940: 3110 87f0 0000 0000 ffff ffff 0000 0000  1...............
0005950: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00059f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005a00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0005bf0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005c00: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0005c10: 0700 0100 3800 0100 b801 0000 0004 0000  ....8...........
0005c20: 0000 0000 0000 0000 0400 0000 0700 0000  ................
0005c30: 0200 0000 0000 0000 1000 0000 4800 0000  ............H...
0005c40: 0000 1800 0000 0000 3000 0000 1800 0000  ........0.......
0005c50: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005c60: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0005c70: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0005c80: 3000 0000 6800 0000 0000 1800 0000 0200  0...h...........
0005c90: 4c00 0000 1800 0100 0500 0000 0000 0500  L...............
0005ca0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0005cb0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0005cc0: 0020 0000 0000 0000 0020 0000 0000 0000  . ....... ......
0005cd0: 0600 0000 0000 0000 0503 2400 4200 6f00  ..........$.B.o.
0005ce0: 6f00 7400 0000 0000 5000 0000 8000 0000  o.t.....P.......
0005cf0: 0000 1800 0000 0300 6400 0000 1800 0000  ........d.......
0005d00: 0100 0480 4800 0000 5400 0000 0000 0000  ....H...T.......
0005d10: 1400 0000 0200 3400 0200 0000 0000 1400  ......4.........
0005d20: 8900 1200 0101 0000 0000 0005 1200 0000  ................
0005d30: 0000 1800 8900 1200 0102 0000 0000 0005  ................
0005d40: 2000 0000 2002 0000 0101 0000 0000 0005   ... ...........
0005d50: 1200 0000 0102 0000 0000 0005 2000 0000  ............ ...
0005d60: 2002 0000 0000 0000 8000 0000 4800 0000   ...........H...
0005d70: 0100 4000 0000 0100 0000 0000 0000 0000  ..@.............
0005d80: 0100 0000 0000 0000 4000 0000 0000 0000  ........@.......
0005d90: 0020 0000 0000 0000 0020 0000 0000 0000  . ....... ......
0005da0: 0020 0000 0000 0000 1102 0000 0000 0000  . ..............
0005db0: ffff ffff 0000 0000 0000 0000 0000 0000  ................
0005dc0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0005df0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0005e00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0005ff0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006000: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0006010: 0800 0100 3800 0100 7801 0000 0004 0000  ....8...x.......
0006020: 0000 0000 0000 0000 0400 0000 0800 0000  ................
0006030: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0006040: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0006050: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006060: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006070: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0006080: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0006090: 0000 0000 0000 0000 3000 0000 7000 0000  ........0...p...
00060a0: 0000 1800 0000 0300 5200 0000 1800 0100  ........R.......
00060b0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
00060c0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00060d0: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
00060e0: 0000 0000 0000 0000 0600 0000 0000 0000  ................
00060f0: 0803 2400 4200 6100 6400 4300 6c00 7500  ..$.B.a.d.C.l.u.
0006100: 7300 ffff 0000 0000 8000 0000 1800 0000  s...............
0006110: 0000 1800 0000 0200 0000 0000 1800 0000  ................
0006120: 8000 0000 5000 0000 0104 4000 0000 0100  ....P.....@.....
0006130: 0000 0000 0000 0000 fe83 0700 0000 0000  ................
0006140: 4800 0000 0000 0000 00f0 3f78 0000 0000  H.........?x....
0006150: 00f0 3f78 0000 0000 0000 0000 0000 0000  ..?x............
0006160: 2400 4200 6100 6400 03ff 8307 0000 0000  $.B.a.d.........
0006170: ffff ffff 0000 0000 0000 0000 0000 0000  ................
0006180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00061f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006200: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00063f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006400: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0006410: 0900 0100 3800 0900 a802 0000 0004 0000  ....8...........
0006420: 0000 0000 0000 0000 0500 0000 0900 0000  ................
0006430: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0006440: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0006450: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006460: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006470: 0600 0020 0000 0000 0000 0000 0000 0000  ... ............
0006480: 0000 0000 0101 0000 0000 0000 0000 0000  ................
0006490: 0000 0000 0000 0000 3000 0000 6800 0000  ........0...h...
00064a0: 0000 1800 0000 0100 5000 0000 1800 0100  ........P.......
00064b0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
00064c0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00064d0: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
00064e0: 0000 0000 0000 0000 0600 0020 0000 0000  ........... ....
00064f0: 0703 2400 5300 6500 6300 7500 7200 6500  ..$.S.e.c.u.r.e.
0006500: 8000 0000 5000 0000 0104 4000 0000 0200  ....P.....@.....
0006510: 0000 0000 0000 0000 4000 0000 0000 0000  ........@.......
0006520: 4800 0000 0000 0000 0010 0400 0000 0000  H...............
0006530: fc00 0400 0000 0000 fc00 0400 0000 0000  ................
0006540: 2400 5300 4400 5300 3141 97f0 0000 0000  $.S.D.S.1A......
0006550: 9000 0000 b000 0000 0004 1800 0000 0300  ................
0006560: 9000 0000 2000 0000 2400 5300 4400 4800  .... ...$.S.D.H.
0006570: 0000 0000 1200 0000 0010 0000 0100 0000  ................
0006580: 1000 0000 8000 0000 8000 0000 0000 0000  ................
0006590: 1800 1400 0000 0000 3000 0800 0000 0000  ........0.......
00065a0: 5124 b300 0101 0000 5124 b300 0101 0000  Q$......Q$......
00065b0: 8000 0000 0000 0000 7c00 0000 4900 4900  ........|...I.I.
00065c0: 1800 1400 0000 0000 3000 0800 0000 0000  ........0.......
00065d0: f012 03f8 0001 0000 f012 03f8 0001 0000  ................
00065e0: 0000 0000 0000 0000 7c00 0000 4900 4900  ........|...I.I.
00065f0: 0000 0000 0000 0000 1000 0000 0200 0200  ................
0006600: 9000 0000 a000 0000 0004 1800 0000 0400  ................
0006610: 8000 0000 2000 0000 2400 5300 4900 4900  .... ...$.S.I.I.
0006620: 0000 0000 1000 0000 0010 0000 0100 0000  ................
0006630: 1000 0000 7000 0000 7000 0000 0000 0000  ....p...p.......
0006640: 1400 1400 0000 0000 2800 0400 0000 0000  ........(.......
0006650: 0001 0000 f012 03f8 0001 0000 0000 0000  ................
0006660: 0000 0000 7c00 0000 1400 1400 0000 0000  ....|...........
0006670: 2800 0400 0000 0000 0101 0000 5124 b300  (...........Q$..
0006680: 0101 0000 8000 0000 0000 0000 7c00 0000  ............|...
0006690: 0000 0000 0000 0000 1000 0000 0200 0000  ................
00066a0: ffff ffff 0000 0000 0000 0000 0000 0000  ................
00066b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00067f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006800: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0006810: 0a00 0100 3800 0100 5001 0000 0004 0000  ....8...P.......
0006820: 0000 0000 0000 0000 0300 0000 0a00 0000  ................
0006830: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0006840: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0006850: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006860: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006870: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0006880: 0000 0000 0001 0000 0000 0000 0000 0000  ................
0006890: 0000 0000 0000 0000 3000 0000 6800 0000  ........0...h...
00068a0: 0000 1800 0000 0200 5000 0000 1800 0100  ........P.......
00068b0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
00068c0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
00068d0: 80ff d045 98fe cb01 0000 0200 0000 0000  ...E............
00068e0: 0000 0200 0000 0000 0600 0000 0000 0000  ................
00068f0: 0703 2400 5500 7000 4300 6100 7300 6500  ..$.U.p.C.a.s.e.
0006900: 8000 0000 4800 0000 0100 4000 0000 0100  ....H.....@.....
0006910: 0000 0000 0000 0000 1f00 0000 0000 0000  ................
0006920: 4000 0000 0000 0000 0000 0200 0000 0000  @...............
0006930: 0000 0200 0000 0000 0000 0200 0000 0000  ................
0006940: 3120 d8f0 0000 0000 ffff ffff 0000 0000  1 ..............
0006950: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00069f0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006a00: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
0006bf0: 0000 0000 0000 0000 0000 0000 0000 0200  ................
0006c00: 4649 4c45 3000 0300 0000 0000 0000 0000  FILE0...........
0006c10: 0b00 0100 3800 0300 8002 0000 0004 0000  ....8...........
0006c20: 0000 0000 0000 0000 0300 0000 0b00 0000  ................
0006c30: 0200 0000 0000 0000 1000 0000 6000 0000  ............`...
0006c40: 0000 1800 0000 0000 4800 0000 1800 0000  ........H.......
0006c50: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006c60: 80d2 9f44 98fe cb01 80d2 9f44 98fe cb01  ...D.......D....
0006c70: 0600 0000 0000 0000 0000 0000 0000 0000  ................
0006c80: 0000 0000 0101 0000 0000 0000 0000 0000  ................
0006c90: 0000 0000 0000 0000 3000 0000 6800 0000  ........0...h...
0006ca0: 0000 1800 0000 0100 5000 0000 1800 0100  ........P.......
0006cb0: 0500 0000 0000 0500 80ff d045 98fe cb01  ...........E....
0006cc0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0006cd0: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
0006ce0: 0000 0000 0000 0000 0600 0010 0000 0000  ................
0006cf0: 0703 2400 4500 7800 7400 6500 6e00 6400  ..$.E.x.t.e.n.d.
0006d00: 9000 0000 7801 0000 0004 1800 0000 0200  ....x...........
0006d10: 5801 0000 2000 0000 2400 4900 3300 3000  X... ...$.I.3.0.
0006d20: 3000 0000 0100 0000 0010 0000 0100 0000  0...............
0006d30: 1000 0000 4801 0000 4801 0000 0000 0000  ....H...H.......
0006d40: 1900 0000 0000 0100 6000 4e00 0000 0000  ........`.N.....
0006d50: 0b00 0000 0000 0b00 80ff d045 98fe cb01  ...........E....
0006d60: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0006d70: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
0006d80: 0000 0000 0000 0000 2600 0020 0000 0000  ........&.. ....
0006d90: 0603 2400 4f00 6200 6a00 4900 6400 0000  ..$.O.b.j.I.d...
0006da0: 1800 0000 0000 0100 6000 4e00 0000 0000  ........`.N.....
0006db0: 0b00 0000 0000 0b00 80ff d045 98fe cb01  ...........E....
0006dc0: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0006dd0: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
0006de0: 0000 0000 0000 0000 2600 0020 0000 0000  ........&.. ....
0006df0: 0603 2400 5100 7500 6f00 7400 6100 0200  ..$.Q.u.o.t.a...
0006e00: 1a00 0000 0000 0100 6800 5200 0000 0000  ........h.R.....
0006e10: 0b00 0000 0000 0b00 80ff d045 98fe cb01  ...........E....
0006e20: 80ff d045 98fe cb01 80ff d045 98fe cb01  ...E.......E....
0006e30: 80ff d045 98fe cb01 0000 0000 0000 0000  ...E............
0006e40: 0000 0000 0000 0000 2600 0020 0000 0000  ........&.. ....
0006e50: 0803 2400 5200 6500 7000 6100 7200 7300  ..$.R.e.p.a.r.s.
0006e60: 6500 0000 0000 0000 0000 0000 0000 0000  e...............
0006e70: 1000 0000 0200 0000 ffff ffff 0000 0000  ................
0006e80: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
      

The metadata

Looking through the previous, we see the 12 metadata files $MFT, $MFTMirr, $LogFile, $Volume, $AttrDef, $., $Bitmap, $Boot, $BadClus, $Secure, $UpCase, and $Extend.

The $MFT entry is self-referential; it refers to itself.

The $MFTMirr entry is equally self-referential; it's just a mirror of the $MFT.

The $LogFile entry contains the journal for metadata transactions.

The $Volume entry contains information like the label and version of this volume.

The $AttrDef entry contains the attribute defintions, such as identifier values, names, and sizes.

The $. entry contains the root directory of the filesystem.

The $Bitmap entry contains a bitmap of the allocation of each cluster. (Finally, we find something that resembles other filesystems!)

The $Boot entry contains the boot sector and boot code for the file system (sort of!)

The $BadClus entry contains the clusters that have bad sectors (and yes, these can hide information using these, just as they could in FAT.)

The $Secure entry contains security information such as access.

The $Upcase entry contains the uppercase version of each Unicode character.

The $Extend entry contains files for optional extensions.

MFT Entries

We kind of leaped into looking at the raw entries; let's move back now and try to find some structure in the MFT entries.

The first thing to understand is that each MFT entry is each 1k in size (at least, so far — this is actually specified in the filesystem and Microsoft could conceivably use larger MFTs). The first 42 bytes contain fixed data for 12 fields; the remaining 982 bytes contain "attributes".

The first four bytes (0 through 3) give a "magic number" indicating what the MFT is for. "FILE" indicates this is an ordinary file. "BAAD" indicates that there's a problem with this entry. This is actually not considered important!

The next 4 bytes, 4 through 7, fixup array information. Fixups are used as a sort of simple data consistency check.

Bytes 8-17 give journaling information.

Bytes 18 and 19 gives the link count; a file is not deallocated until the link count has been reduced to zero.

Bytes 20 and 21 give the offset to the first attribute.

Bytes 22 and 23 are flags. 0x1 means that file is in use; 0x2 means that it is a directory.

Bytes 24 through 27 are the used bytes of the MFT entry.

Bytes 28 through 31 are the allocated size of the MFT entry.

Bytes 32 through 39 are if this record actually refers to another file, what is that file? (The value is zero if this is a "base record" and doesn't refer to another file.)

Bytes 40 and 41 refer to the next attribute id.

The rest of the record is a set of attribute name/value pairs. The value can either be found inside the record (including the contents of an ordinary file if this is an ordinary file and if it is same enough to fit in the MFT entry) or it can be "non-resident".

Attributes

While the fundamental idea of attribute name/value pairs is simple, the NTFS implementation is quite complex.

The first and perhaps most important attribute at least for applications is called the $STANDARD_INFORMATION attribute. It holds ownership, security, quota, and time/date information.

The next attribute is the $FILE_NAME attribute. While it sounds simple, this attribute is quite complex, including not only a filename (and possibly there are more than that what with NTFS "name spaces"), but its own set of timestamps and filesizes!

The $DATA attribute just means the random data associated with a file. Some anti-virus and backup software, for instance, slap some data into these. Famously, of course, malware can also use these since most standard software will only assume that there is one $DATA attribute; a second a $DATA attribute is also called "alternative data stream" or ADS (remember the long discursion that the WFA book has.)