Skip to content

Follow $MFT $ATTRIBUTE_LIST so fragmented MFT scans read the full table - #73

Merged
tzarebczan merged 4 commits into
mainfrom
fix/mft-attribute-list
Oct 14, 2026
Merged

tzarebczan merged 4 commits into
mainfrom
fix/mft-attribute-list

Conversation

@tzarebczan

Copy link
Copy Markdown
Owner

Fixes #69.

When $MFT is fragmented enough that record 0 cannot hold the whole $DATA run list, NTFS stores the rest in extension records and points at them with $ATTRIBUTE_LIST. The scanner kept only the first unnamed run list in record 0. On the reported C: drive that was 69 extents and about 14.6 GB of a 28.3 GB table, so roughly half the records were never read and path building failed for parents that live in the unread half.

Record 0's attribute list is now followed. Each unnamed $DATA extent is loaded from its extension record (a non-resident list is read from its own runs), and the pieces are joined in starting-VCN order. A missing piece stays a sparse hole so later record numbers stay aligned. If an extension cannot be read, the scan continues with the runs it has. stderr warns when that map is still short of MftValidDataLength, or when extension records were left unread:

mft: warning: $MFT run list covers 14654.7 MB of 28982.5 MB valid data (N extension records unread)

Name lookup for other files is unchanged: an extension record is still read only to recover $DATA size. Overview is unchanged.

The parser is covered by unit tests that run on every platform. mft.rs is Windows-only; it was typechecked here with cargo check --tests --target x86_64-pc-windows-msvc.

Record 0 only holds the first $DATA run list once $MFT spills into
extension records. Read those records from the runs already in hand,
append the rest in starting-VCN order, and warn on stderr when the
joined map is still short of MftValidDataLength.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T23:04:48.880012Z 4049bdc New commits
🔒 Security Review ✅ Completed 2026-10-14T21:24:52.092822Z 7e7da9c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

A non-resident $ATTRIBUTE_LIST is read in whole sectors, and only the
initialized prefix is parsed. A failed list or extension read warns and
continues with the runs already in hand.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23077cf636

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A 1 MiB cap dropped every extension record past the prefix and the
scan still returned that partial map. Size the read from the list's
initialized length and its own runs. Above 32 MiB, keep record 0 and
warn instead of parsing a prefix.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6643d01505

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

… load

A non-resident list whose runs stop short of its initialized length was
parsed as a prefix, so later $DATA extension records disappeared. Keep
record 0 and warn instead. Rebuild the run map before each extension
read so an in-order chain is loaded in one pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4049bdc3a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@tzarebczan
tzarebczan merged commit 6b3d3a9 into main Oct 14, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MFT scan misses ~250 GB when $MFT is fragmented ($ATTRIBUTE_LIST on record 0 not followed)

1 participant