NTFS: Difference between revisions

1,074 bytes removed ,  8 months ago
Added a link to the Windows NT page.
[unchecked revision][unchecked revision]
(Added a link to the Windows NT page.)
 
(11 intermediate revisions by 10 users not shown)
Line 1:
{{Filesystems}}
 
NTFS ('''New Technology File System''') is [[Windows NT]]'s native file system. It is not only based on [[HPFS]], but also supports security features such as access control. Since Windows NT is entirely unicode, NTFS is a unicode filesystem, with each character (e.g. in names) being 16-bits instead of 8-bits.
 
== About ==
Line 27:
The NTFS boot sector is similar to other file systems, like FAT.
 
{| {{wikitable}}
<table border=1>
! Field
<tr><th>Field</th><th>Type</th><th>Length</th></tr>
! Type
<tr><td>JMP</td><td>byte[3]</td><td>3</td></tr>
|-
<tr><td>OEM System</td><td>char[8]</td><td>8</td></tr>
|JMP || int8_t[3]
<tr><td>Bytes Per Sector</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Sectors Per Cluster</td><td>byte</td><td>1</td></tr>
|OEM System || char[8]
<tr><td>Reserved Sector Count</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Table Count</td><td>byte</td><td>1</td></tr>
|Bytes Per Sector || uint16_t
<tr><td>Root Entry Count</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Sector Count</td><td>unsigned short</td><td>2</td></tr>
|Sectors Per Cluster || int8_t
<tr><td>Media Type</td><td>byte</td><td>1</td></tr>
|-
<tr><td>Sectors Per Table</td><td>unsigned short</td><td>2</td></tr>
|Reserved Sector Count || uint16_t
<tr><td>Sectors Per Track</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Hidden Sector Count</td><td>unsigned int</td><td>4</td></tr>
|Table Count || int8_t
<tr><td>Sector Count (32-bit)</td><td>unsigned int</td><td>4</td></tr>
|-
<tr><td>Reserved</td><td>unsigned int</td><td>4</td></tr>
|Root Entry Count || uint16_t
<tr><td>Total Sectors (64-bit)</td><td>unsigned long</td><td>8</td></tr>
|-
</table>
|Sector Count || uint16_t
|-
|Media Type || int8_t
|-
|Sectors Per Table || uint16_t
|-
|Sectors Per Track || uint16_t
|-
|Heads || uint16_t
|-
|Hidden Sector Count || uint32_t
|-
|Sector Count (32-bit) || uint32_t
|-
|Reserved || uint32_t
|-
|Sector Count (64-bit) || uint64_t
|}
 
This is followed immediately by a NTFS specific header.
 
{| {{wikitable}}
<table border=1>
!Field
<tr><th>Field</th><th>Type</th><th>Length</th></tr>
!Type
<tr><td>Master File Table Cluster</td><td>unsigned long</td><td>8</td></tr>
|-
<tr><td>Master File Table Mirror Cluster</td><td>unsigned long</td><td>8</td></tr>
|Master File Table Cluster || uint64_t
<tr><td>Clusters Per Record</td><td>signed byte</td><td>1</td></tr>
|-
<tr><td>Reserved</td><td>byte[3]</td><td>3</td></tr>
|Master File Table Mirror Cluster || uint64_t
<tr><td>Clusters Per Index Buffer</td><td>signed byte</td><td>1</td></tr>
|-
<tr><td>Reserved</td><td>byte[3]</td><td>3</td></tr>
|Clusters Per Record || int8_t
<tr><td>Serial Number</td><td>unsigned int</td><td>4</td></tr>
|-
<tr><td>Checksum</td><td>unsigned short</td><td>2</td></tr>
|Reserved || int8_t[3]
</table>
|-
|Clusters Per Index Buffer || int8_t
|-
|Reserved || int8_t[3]
|-
|Serial Number || uint64_t
|-
|Checksum || uint32_t
|}
 
Using the "Master File Table Cluster" and "Sectors Per Cluster" values, you can find the Master File Table. This table contains entries for every object in the file system, including files, folders, and the tables themselves. The size of each record in the Master File Table can be calculated using the "Clusters Per Record" and "Sectors Per Cluster" fields from the boot sector.
Line 64 ⟶ 91:
Each record starts with the same header structure.
 
{| {{wikitable}}
<table border=1>
! Field
<tr><th>Field</th><th>Type</th><th>Length</th></tr>
! Type
<tr><td>Record Type</td><td>char[4]</td><td>4</td></tr>
|-
<tr><td>Update Sequence Offset</td><td>unsigned short</td><td>2</td></tr>
|Record Type || char[4]
<tr><td>Update Sequence Length</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Log File Sequence Number</td><td>unsigned long</td><td>8</td></tr>
|Update Sequence Offset || uint16_t
<tr><td>Record Sequence Number</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Hard Link Count</td><td>unsigned short</td><td>2</td></tr>
|Update Sequence Length || uint16_t
<tr><td>Attributes Offset</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Flags</td><td>unsigned short</td><td>2</td></tr>
|Log File Sequence Number || uint64_t
<tr><td>Bytes In Use</td><td>unsigned int</td><td>4</td></tr>
|-
<tr><td>Bytes Allocated</td><td>unsigned int</td><td>4</td></tr>
|Record Sequence Number || uint16_t
<tr><td>Parent Record Number</td><td>unsigned long</td><td>8</td></tr>
|-
<tr><td>Next Attribute Index</td><td>unsigned short</td><td>2</td></tr>
|Hard Link Count || uint16_t
<tr><td>Reserved</td><td>unsigned short</td><td>2</td></tr>
|-
<tr><td>Record Number</td><td>unsigned int</td><td>4</td></tr>
|Attributes Offset || uint16_t
</table>
|-
|Flags || uint16_t
|-
|Bytes In Use || uint32_t
|-
|Bytes Allocated || uint32_t
|-
|Parent Record Number || uint64_t
|-
|Next Attribute Index || uint32_t
|-
|Reserved || uint32_t
|-
|Record Number || uint64_t
|}
 
The remainder of the file record contains additional tables and data for this record. The "Attributes Offset" field contains the byte offset (from the start of the record) of the beginning of the attribute list for this record.
Line 86 ⟶ 128:
Attributes have a variable length, but always start with the same sequence.
 
{| {{wikitable}}
<table border=1>
! Field
<tr><th>Field</th><th>Type</th><th>Length</th></tr>
! Type
<tr><td>Attribute Type</td><td>unsigned int</td><td>4</td></tr>
|-
</table>
| Attribute Type || uint32_t
|}
 
If the "Attribute Type" field contains the value 0xffffffff, this marks the end of the attribute list. Otherwise, the attribute sequence continues with the length of the attribute "record".
 
{| {{wikitable}}
<table border=1>
! Field
<tr><th>Field</th><th>Type</th><th>Length</th></tr>
! Type
<tr><td>Attribute Length</td><td>unsigned int</td><td>4</td></tr>
|-
</table>
| Attribute Length || uint32_t
|}
 
This length value defines the total length of the attribute record, including the "Attribute Type" and "Attribute Length" fields.
 
== LinksSee Also ==
=== External Links ===
* [http://www.linux-ntfs.org/ The Linux NTFS project.]
* [https://web.archive.org/web/20210922203602/https://flatcap.org/linux-ntfs/ntfs/index.html Guide to NTFS]
* [https://www.writeblocked.org/resources/NTFS_CHEAT_SHEETS.pdf Cheat sheet]
* [http://www.linux-ntfs.org/ The Linux NTFS project]
* [http://www.ntfs-3g.org/ NTFS-3G Read/Write Drivers For Linux/FreeBSD/BeOS]
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=fs/ntfs;hb=HEAD GIT Linux fs/ntfs tree]
* [http://www.opensource.apple.com/source/ntfs/ Apple Open Source NTFS site]
* [https://github.com/libyal/libfsntfs/blob/main/documentation/New%20Technologies%20File%20System%20(NTFS).asciidoc#attribute_chains libfsntfs library documentation]
 
[[Category:Filesystems]]
[[de:NTFS]]
Anonymous user