Repair NTFS MFT

Using TestDisk to repair the filesystem
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
lukasl1991
Posts: 4
Joined: 27 Aug 2019, 08:50

Repair NTFS MFT

#1 Post by lukasl1991 »

Hello, I am trying to recover a non-readable NTFS partition from my harddisk running testdisk under Linux.

This is the fdisk otuput: (German, but I think the terms are clear)
Festplatte /dev/sdb: 465,8 GiB, 500107862016 Bytes, 976773168 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0xa3f894bd

Gerät Boot Anfang Ende Sektoren Größe Kn Typ
/dev/sdb1 * 63 419428799 419428737 200G 7 HPFS/NTFS/exFAT
/dev/sdb2 419428800 976751999 557323200 265,8G f W95 Erw. (LBA)
/dev/sdb5 419428863 976751999 557323137 265,8G 7 HPFS/NTFS/exFAT
sdb2/5 is accessible under Linux. (What is the difference between these two? Whey do they overlap? Windows only showed them to me as D: Could someone explain this?) sdb1 is not mountable. I read the different testdisk usage examples like https://www.cgsecurity.org/wiki/TestDisk_Step_By_Step and https://www.cgsecurity.org/wiki/Advance ... MFT_Repair but had no success. Testdisk tells me the following about my partition structure:
Analyse Disk /dev/sdb - 500 GB / 465 GiB - CHS 64601 240 63
Geometry from i386 MBR: head=240 sector=63
NTFS at 0/1/1
NTFS at 27740/1/1
get_geometry_from_list_part_aux head=240 nbr=6
get_geometry_from_list_part_aux head=8 nbr=6
get_geometry_from_list_part_aux head=16 nbr=6
get_geometry_from_list_part_aux head=32 nbr=6
get_geometry_from_list_part_aux head=64 nbr=6
get_geometry_from_list_part_aux head=128 nbr=1
get_geometry_from_list_part_aux head=240 nbr=6
get_geometry_from_list_part_aux head=255 nbr=1
Current partition structure:
1 * HPFS - NTFS 0 1 1 27739 239 63 419428737
2 E extended LBA 27740 0 1 64599 239 63 557323200
5 L HPFS - NTFS 27740 1 1 64599 239 63 557323137
$MFT must be non-resident.
Failed to load $MFT: I/O error
$MFT must be non-resident.
Failed to load $MFT: I/O error
$MFT must be non-resident.
Failed to load $MFT: I/O error
$MFT must be non-resident.
Failed to load $MFT: I/O error
Moreover it tells me that the boot sectors of sdb1 are identical:
ntfs_boot_sector
1 * HPFS - NTFS 0 1 1 27739 239 63 419428737
NTFS, blocksize=4096, 214 GB / 199 GiB
NTFS at 0/1/1
NTFS at 0/1/1
filesystem size 419428737
sectors_per_cluster 8
mft_lcn 786432
mftmirr_lcn 2
clusters_per_mft_record -10
clusters_per_index_record 1
Boot sector
Status: OK

Backup boot sector
Status: OK

Sectors are identical.
I am a little bit confused about the contens of my boot sectors:
Boot sector Backup boot sector
0000 eb52904e 54465320 .R.NTFS eb52904e 54465320 .R.NTFS
0008 20202000 02080000 ..... 20202000 02080000 .....
0010 00000000 00f80000 ........ 00000000 00f80000 ........
0018 3f00f000 3f000000 ?...?... 3f00f000 3f000000 ?...?...
0020 00000000 80008000 ........ 00000000 80008000 ........
0028 80f9ff18 00000000 ........ 80f9ff18 00000000 ........
0030 00000c00 00000000 ........ 00000c00 00000000 ........
0038 02000000 00000000 ........ 02000000 00000000 ........
0040 f6000000 01000000 ........ f6000000 01000000 ........
0048 8a2652e6 3852e648 .&R.8R.H 8a2652e6 3852e648 .&R.8R.H
0050 00000000 fa33c08e .....3.. 00000000 fa33c08e .....3..
0058 d0bc007c fb68c007 ...|.h.. d0bc007c fb68c007 ...|.h..
0060 1f1e6866 00cb8816 ..hf.... 1f1e6866 00cb8816 ..hf....
0068 0e006681 3e03004e ..f.>..N 0e006681 3e03004e ..f.>..N
0070 54465375 15b441bb TFSu..A. 54465375 15b441bb TFSu..A.
0078 aa55cd13 720c81fb .U..r... aa55cd13 720c81fb .U..r...
0080 55aa7506 f7c10100 U.u..... 55aa7506 f7c10100 U.u.....
0088 7503e9dd 001e83ec u....... 7503e9dd 001e83ec u.......
0090 18681a00 b4488a16 .h...H.. 18681a00 b4488a16 .h...H..
0098 0e008bf4 161fcd13 ........ 0e008bf4 161fcd13 ........
00A0 9f83c418 9e581f72 .....X.r 9f83c418 9e581f72 .....X.r
00A8 e13b060b 0075dba3 .;...u.. e13b060b 0075dba3 .;...u..
00B0 0f00c12e 0f00041e ........ 0f00c12e 0f00041e ........
00B8 5a33dbb9 00202bc8 Z3... +. 5a33dbb9 00202bc8 Z3... +.
00C0 66ff0611 0003160f f....... 66ff0611 0003160f f.......
00C8 008ec2ff 061600e8 ........ 008ec2ff 061600e8 ........
00D0 4b002bc8 77efb800 K.+.w... 4b002bc8 77efb800 K.+.w...
00D8 bbcd1a66 23c0752d ...f#.u- bbcd1a66 23c0752d ...f#.u-
00E0 6681fb54 43504175 f..TCPAu 6681fb54 43504175 f..TCPAu
00E8 2481f902 01721e16 $....r.. 2481f902 01721e16 $....r..
00F0 6807bb16 68700e16 h...hp.. 6807bb16 68700e16 h...hp..
00F8 68090066 53665366 h..fSfSf 68090066 53665366 h..fSfSf
0100 55161616 68b80166 U...h..f 55161616 68b80166 U...h..f
0108 610e07cd 1a33c0bf a....3.. 610e07cd 1a33c0bf a....3..
0110 2810b9d8 0ffcf3aa (....... 2810b9d8 0ffcf3aa (.......
0118 e95f0190 9066601e ._...f`. e95f0190 9066601e ._...f`.
0120 0666a111 00660306 .f...f.. 0666a111 00660306 .f...f..
0128 1c001e66 68000000 ...fh... 1c001e66 68000000 ...fh...
0130 00665006 53680100 .fP.Sh.. 00665006 53680100 .fP.Sh..
0138 681000b4 428a160e h...B... 681000b4 428a160e h...B...
0140 00161f8b f4cd1366 .......f 00161f8b f4cd1366 .......f
0148 595b5a66 5966591f Y[ZfYfY. 595b5a66 5966591f Y[ZfYfY.
0150 0f821600 66ff0611 ....f... 0f821600 66ff0611 ....f...
0158 0003160f 008ec2ff ........ 0003160f 008ec2ff ........
0160 0e160075 bc071f66 ...u...f 0e160075 bc071f66 ...u...f
0168 61c3a0f8 01e80900 a....... 61c3a0f8 01e80900 a.......
0170 a0fb01e8 0300f4eb ........ a0fb01e8 0300f4eb ........
0178 fdb4018b f0ac3c00 ......<. fdb4018b f0ac3c00 ......<.
0180 7409b40e bb0700cd t....... 7409b40e bb0700cd t.......
0188 10ebf2c3 0d0a4120 ......A 10ebf2c3 0d0a4120 ......A
0190 6469736b 20726561 disk rea 6469736b 20726561 disk rea
0198 64206572 726f7220 d error 64206572 726f7220 d error
01A0 6f636375 72726564 occurred 6f636375 72726564 occurred
01A8 000d0a42 4f4f544d ...BOOTM 000d0a42 4f4f544d ...BOOTM
01B0 47522069 73206d69 GR is mi 47522069 73206d69 GR is mi
01B8 7373696e 67000d0a ssing... 7373696e 67000d0a ssing...
01C0 424f4f54 4d475220 BOOTMGR 424f4f54 4d475220 BOOTMGR
01C8 69732063 6f6d7072 is compr 69732063 6f6d7072 is compr
01D0 65737365 64000d0a essed... 65737365 64000d0a essed...
01D8 50726573 73204374 Press Ct 50726573 73204374 Press Ct
01E0 726c2b41 6c742b44 rl+Alt+D 726c2b41 6c742b44 rl+Alt+D
01E8 656c2074 6f207265 el to re 656c2074 6f207265 el to re
01F0 73746172 740d0a00 start... 73746172 740d0a00 start...
01F8 8ca9bed6 000055aa ......U. 8ca9bed6 000055aa ......U.
Is it normal to see such contents inside there? BOOTMGR is missing? Restoring MFT fails after some time with a memory corruption error.

Is there still a chance to get my data back? Please let me know if I need to offer more information.

Thanks in advance!

Lukas

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Repair NTFS MFT

#2 Post by cgrenier »

The boot sector is normal, including the embedded error message.
You use PhotoRec to recover your data but it will not recover the original filenames.

lukasl1991
Posts: 4
Joined: 27 Aug 2019, 08:50

Re: Repair NTFS MFT

#3 Post by lukasl1991 »

Thank you for your reply! I did not know that the embedded error message is normal. Is there no way to repair the broken MFT? Can I somehow address the memory corruption error?

Furthermore: How exactly do I have to interpret the single numbers in each row?
Current partition structure:
1 * HPFS - NTFS 0 1 1 27739 239 63 419428737
2 E extended LBA 27740 0 1 64599 239 63 557323200
5 L HPFS - NTFS 27740 1 1 64599 239 63 557323137

recuperation
Posts: 2720
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Repair NTFS MFT

#4 Post by recuperation »

lukasl1991 wrote: 28 Aug 2019, 16:50
lukasl1991 wrote: 27 Aug 2019, 09:13
Gerät Boot Anfang Ende Sektoren Größe Kn Typ
/dev/sdb1 * 63 419428799 419428737 200G 7 HPFS/NTFS/exFAT
/dev/sdb2 419428800 976751999 557323200 265,8G f W95 Erw. (LBA)
/dev/sdb5 419428863 976751999 557323137 265,8G 7 HPFS/NTFS/exFAT
sdb2/5 is accessible under Linux. (What is the difference between these two? Whey do they overlap? Windows only showed them to me as D: Could someone explain this?)
Mehrere Partitionen werden im alten MBR-Schema mit Hilfe einer verketteten Liste von Partitionstabellen dargestellt.
sdb2 ist nur eine Hülle, eine erweiterte Partition. Die sieht man auch z.B. beim Partitionieren - zumindest unter XP.
Die verwirrende Darstellung rührt daher, dass man die Spezifikation für Partitionstabellen später aufgebohrt hat, um mehrere Partitionen darstellen zu können.

Die beste mir bekannte deutsche Darstellung zum Thema MBR und Partitionstabellen findet sich in
"Mit dem Diskeditor auf Datensuche". c't 06/2000, S. 116 => Artikel kaufen, oder gleich das ganze Heft, wenn Heise es noch hat.
Falls nur der Artikel erhältlich ist, Heise um eine entgeltliche Farbkopie bitten.
Is there still a chance to get my data back? Please let me know if I need to offer more information.
Andere Recoverysoftware ausprobieren oder die NTFS-Datenstrukturen lernen und sich von Hand durchpfriemeln!
lukasl1991 wrote: 28 Aug 2019, 16:50 Furthermore: How exactly do I have to interpret the single numbers in each row?

Current partition structure:
1 * HPFS - NTFS 0 1 1 27739 239 63 419428737
2 E extended LBA 27740 0 1 64599 239 63 557323200
5 L HPFS - NTFS 27740 1 1 64599 239 63 557323137
[Partitionsnummer in Linux-Nummerierung] [Partitionstyp] [Dateisystem] [ chs-Adresse vom Anfang] [chs-Adresse vom Ende]

lukasl1991
Posts: 4
Joined: 27 Aug 2019, 08:50

Re: Repair NTFS MFT

#5 Post by lukasl1991 »

Danke für deine Antwort!
Die beste mir bekannte deutsche Darstellung zum Thema MBR und Partitionstabellen findet sich in
"Mit dem Diskeditor auf Datensuche". c't 06/2000, S. 116 => Artikel kaufen, oder gleich das ganze Heft, wenn Heise es noch hat.
Falls nur der Artikel erhältlich ist, Heise um eine entgeltliche Farbkopie bitten.
Da muss ich mir wohl erst noch einige Grundlagen erarbeiten... Ich werde mich um diesen Artikel bemühen.
Can I somehow address the memory corruption error?
Das habe ich übrigens falsch übersetzt. Es handelt sich um einen Speicherzugriffsfehler, Segmentation Fault. Der Backtrace in gdb ist leider leer (wahrscheinlich weil Release Build). Rebuild BS stürzt allerdings immer wieder bei 209321984/419428737 ab.
MFT and MFT mirror are bad. Failed to repair them.
Hat ein Reparaturversuch überhaupt noch Sinn wenn beide Bootsektoren OK und identisch sind, aber MFT und MFT mirror beide kaputt? Wenn ich es richtig verstanden habe, enthält der Bootsektor die Startadresse der MFT. Der MFT Mirror wird wiederum aus der MFT heraus referenziert. Ist es denn möglich, dass beide Bootsektoren auf die falsche MFT-Startadresse zeigen und deshalb sowohl die vermeintliche MFT als auch auch der vermeintliche MFT Mirror korrupt sind?


Mit der Deeper Search hatte ich jetzt übrigens doch etwas Glück. (Vor dem Schreiben der neuen Partitionstabellen habe ich ein Image von der Platte gemacht.)
NTFS, blocksize=4096, 214 GB / 199 GiB
HPFS - NTFS 1 1 1 43698 239 63 660713697
NTFS found using backup sector, blocksize=4096, 338 GB / 315 GiB
HPFS - NTFS 1625 127 48 43428 234 42 632068096
NTFS found using backup sector, blocksize=4096, 323 GB / 301 GiB
HPFS - NTFS 27740 1 1 64599 239 63 557323137
NTFS, blocksize=4096, 285 GB / 265 GiB
HPFS - NTFS 43699 0 1 64599 239 63 316023120
NTFS, blocksize=4096, 161 GB / 150 GiB
HPFS - NTFS 43699 210 35 64601 62 46 316028928
NTFS found using backup sector, blocksize=4096, 161 GB / 150 GiB
Eine dieser Partitionen hat tatsächlich mein C: angezeigt. Allerdings liegt die C:-Partition jetzt weit hinten, dort wo damals D: lag. Außerdem sind bei weitem nicht alle Dateien vorhanden. Wie kann das sein?

recuperation
Posts: 2720
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Repair NTFS MFT

#6 Post by recuperation »

lukasl1991 wrote: 29 Aug 2019, 10:18
Can I somehow address the memory corruption error?
Das habe ich übrigens falsch übersetzt. Es handelt sich um einen Speicherzugriffsfehler, Segmentation Fault. Der Backtrace in gdb ist leider leer (wahrscheinlich weil Release Build). Rebuild BS stürzt allerdings immer wieder bei 209321984/419428737 ab.
Ich kann kein C. Aus den öffentlichen Codequellen müsste man aber auch einen Debug-Build bauen können.
MFT and MFT mirror are bad. Failed to repair them.
Hat ein Reparaturversuch überhaupt noch Sinn wenn beide Bootsektoren OK und identisch sind, aber MFT und MFT mirror beide kaputt?
Ich weiß nicht, wie der Kaputt-Status von Testdisk überprüft wird. Wenn einfach nur an den beiden Adressen, auf die der Bootsektor zeigt, keine zulässige MFT und MFT-Mirror liegt, kann sie ja auch noch anderswo auf der Festplatte liegen.
Wenn ich es richtig verstanden habe, enthält der Bootsektor die Startadresse der MFT. Der MFT Mirror wird wiederum aus der MFT heraus referenziert.
Nein, der Bootsektor enthält beide Adressen.
Ist es denn möglich, dass beide Bootsektoren auf die falsche MFT-Startadresse zeigen und deshalb sowohl die vermeintliche MFT als auch auch der vermeintliche MFT Mirror korrupt sind?
Ja, ich meine schon. Eventuell liegt irgendwo die richtige MFT und ihr Mirror auf der Platte.
Da muss man aber in den Code gucken, was Testdisk genau macht, um sicher zu sein.

Mit der Deeper Search hatte ich jetzt übrigens doch etwas Glück. (Vor dem Schreiben der neuen Partitionstabellen habe ich ein Image von der Platte gemacht.)
NTFS, blocksize=4096, 214 GB / 199 GiB
HPFS - NTFS 1 1 1 43698 239 63 660713697
NTFS found using backup sector, blocksize=4096, 338 GB / 315 GiB
HPFS - NTFS 1625 127 48 43428 234 42 632068096
NTFS found using backup sector, blocksize=4096, 323 GB / 301 GiB
HPFS - NTFS 27740 1 1 64599 239 63 557323137
NTFS, blocksize=4096, 285 GB / 265 GiB
HPFS - NTFS 43699 0 1 64599 239 63 316023120
NTFS, blocksize=4096, 161 GB / 150 GiB
HPFS - NTFS 43699 210 35 64601 62 46 316028928
NTFS found using backup sector, blocksize=4096, 161 GB / 150 GiB
Eine dieser Partitionen hat tatsächlich mein C: angezeigt. Allerdings liegt die C:-Partition jetzt weit hinten, dort wo damals D: lag.
Die Belegung der Partitionen mit Buchstaben durch Windows hängt unter anderem vom Partitionsstatus ab. Die primären kommen vor den logischen Partitionen.
Außerdem sind bei weitem nicht alle Dateien vorhanden. Wie kann das sein?
Wie sollten alle Dateien vorhanden sein? Das unterstellt ein definiertes Fehlerbild in Form von Partitionsverlust. Hier ist vermutlich mehr kaputt. Generell kann man die Frage, warum Dateien weg sind, nicht beantworten, das ist auch müßig.

lukasl1991
Posts: 4
Joined: 27 Aug 2019, 08:50

Re: Repair NTFS MFT

#7 Post by lukasl1991 »

Ich meinte eher "Wie kann das sein, dass die C-Partition plötzlich "hinten" auftauscht, wobei dort doch immer D war.
Ich habe inzwischen mal R Studio ausprobiert. Ist die MFT Position bei 3 GB nicht etwas komisch? Ich dachte, die MFT ist ziemlich weit vorn zu finden?
https://www.dropbox.com/s/ektw01nodagdp ... 4.jpg?dl=0

recuperation
Posts: 2720
Joined: 04 Jan 2019, 09:48
Location: Hannover, Deutschland (Germany, Allemagne)

Re: Repair NTFS MFT

#8 Post by recuperation »

lukasl1991 wrote: 01 Sep 2019, 10:21 Ich meinte eher "Wie kann das sein, dass die C-Partition plötzlich "hinten" auftauscht, wobei dort doch immer D war.
s.o.
Ändert man den Status z.B. von logisch auf primär, ändert sich die Belegung mit Buchstaben.
Ich habe inzwischen mal R Studio ausprobiert. Ist die MFT Position bei 3 GB nicht etwas komisch? Ich dachte, die MFT ist ziemlich weit vorn zu finden?
https://www.dropbox.com/s/ektw01nodagdp ... 4.jpg?dl=0
Es gibt keine feste Position für die MFT.

Locked