NTFS $MFT inspection in SQL — parse record headers, triage well-formedness and reconstruct file paths straight from read_blob('$MFT')
Maintainer(s):
alitrack
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL mft FROM community;
LOAD mft;
Example
INSTALL mft FROM community;
LOAD mft;
-- Wire it to a carved $MFT: the table is just a BLOB column
-- SELECT mft_record_header(read_blob('$MFT'), 12);
-- SELECT mft_full_path(read_blob('$MFT'), 12);
-- Self-contained probe: garbage input is reported, never crashes
SELECT (mft_well_formed(CAST('garbage' AS BLOB), 0)).ok;
About mft
mft — NTFS Master File Table in SQL
The $MFT is the NTFS file system's heart: every file's timestamps, size, stream layout and path. These are the first inspection primitives a DFIR analyst needs, as SQL functions over a BLOB column.
| Function | Returns | Notes |
|---|---|---|
mft_record_header(mft, n) |
STRUCT | Signature, flags, in_use, is_dir, sequence, timestamps |
mft_well_formed(mft, n) |
STRUCT |
ok / kind / error triage |
mft_full_path(mft, n) |
VARCHAR | Reconstructed parent path for the entry |
→ GitHub
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| mft_full_path | scalar | NULL | NULL | |
| mft_record_header | scalar | NULL | NULL | |
| mft_well_formed | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |
© 2026 DuckDB Foundation, Amsterdam NL