Extraction de fichiers : comment fonctionne la récupération de données

Sculpture sur lime Il recherche et extrait les fichiers en lisant directement leurs données, plutôt qu’en utilisant les entrées du système de fichiers. Il recherche des séquences d’octets connues, vérifie la structure du fichier et identifie les points de début et de fin probables. Cela peut s’avérer utile lorsque les entrées de dossiers ou de fichiers ont disparu. Cependant, cette méthode ne permet pas nécessairement de récupérer d’anciens noms de fichiers ni de reconstituer des fichiers fragmentés.
Cette méthode fonctionne sur des données qu'un outil est encore capable de lire. Elle s'applique aux disques NTFS, FAT32 et exFAT, ainsi qu'aux disques durs, clés USB, cartes SD, SSD et images disque.
Table des matières
Comment fonctionne le « file carving » ?
Un exemple typique récupération de fichiers Le scan se déroule en quatre étapes :
- Rechercher des données lisibles correspondant à des signatures de fichiers connues.
- Vérifiez chaque correspondance et consultez la structure de son fichier.
- Déterminez les positions probables du début et de la fin du fichier.
- Copiez les données et vérifiez le résultat.
Certains outils analysent l'espace libre. D'autres analysent un volume entier ou une image disque. La zone d'analyse dépend de l'outil et de la tâche à effectuer.
Rechercher les en-têtes et les signatures de fichiers
Une signature de fichier est un ensemble d'octets permettant d'identifier un type de fichier. Un outil de récupération recherche ces signatures afin d'identifier les fichiers potentiels.
Par exemple, un fichier PNG commence par cette signature de huit octets : 89 50 4E 47 0D 0A 1A 0A.
Une correspondance indique la présence éventuelle d'un fichier PNG. Elle ne prouve pas pour autant que l'image complète soit encore intacte. Certains octets peuvent avoir disparu, être endommagés ou être mélangés à des données provenant d'autres fichiers. Récupération de fichiers basée sur les signatures commence par cette recherche, tandis que des méthodes plus approfondies vérifient également la structure du fichier.
Le nom ou l'extension d'un fichier ne constituent pas une preuve suffisante. Renommer un .jpg fichier vers .png ne modifie pas ses données. Les en-têtes peuvent également contenir des champs indiquant la taille, la largeur de l'image ou d'autres détails relatifs au fichier. Voir la Guide sur les signatures de fichiers et les nombres magiques pour découvrir d'autres exemples.
Rechercher le début et la fin d'un fichier
Trouver un en-tête n'est que la première étape. Un outil doit également déterminer le nombre d'octets que compte ce fichier.
Les types de fichiers indiquent leur fin de différentes manières :
- Certains ont un marqueur de fin connu.
- Certains enregistrent la taille d'un fichier ou de données.
- Certains divisent les données en blocs ou en enregistrements.
- D'autres ont besoin d'un analyseur syntaxique pour interpréter la structure du fichier.
Par conséquent, la recherche d'un en-tête et d'un pied de page ne fonctionnera pas pour tous les fichiers. Un marqueur de fin peut également apparaître au sein des données normales. Certains types de fichiers ne comportent pas de marqueur de fin spécifique.
Blocs PNG : pourquoi le premier résultat de l'IEND peut être erroné
Les Spécification PNG du W3C indique qu'un fichier PNG commence par une signature de huit octets. Le format PNG stocke le reste du fichier sous forme de blocs.
Chaque bloc comporte quatre champs :
Champ d'application | Longueur | Objectif |
Longueur | 4 octets | Indique la taille du champ de données |
Type | 4 octets | Donne un nom au bloc |
Données | Variable | Contient les données du bloc |
CRC | 4 octets | Vérifie le type et les données |
Un bloc complet utilise 12 + longueur des données octets. Le champ « Longueur » ne prend pas en compte sa propre valeur, celle du champ « Type » ni le CRC.
Chaque fichier PNG commence par un IHDR bloc. Son champ de données fait toujours 13 octets. Le bloc complet mesure 25 octets.
Sa signature utilise des décalages 0x00–0x07. Le premier bloc commence à 0x08. Le bloc suivant commence à 0x21:
0x08 + 25 = 0x21
Ce calcul indique où commence le bloc suivant.
Prenons l'exemple d'un support pédagogique basé sur un cahier des charges : un fichier PNG valide de 136 octets. Son tEXt chunk holds the text IEND as part of a comment.
Structure | Chunk start | Data length | Next offset |
PNG Signature |
| 8 octets |
|
IHDR |
| 13 bytes |
|
tEXt |
| 56 bytes |
|
IDAT |
| 11 octets |
|
IEND |
| 0 octets |
|

Les tEXt data starts at 0x29. The first text match for IEND is at 0x31. It sits inside the text data. It is not the end of the PNG.
The real IEND chunk starts at 0x7C. Its Type field starts at 0x80. Its Data field has no bytes, so the PNG ends at 0x88.
This sample shows why a byte search is not enough. A byte search finds the first match. A PNG parser reads each Length field and checks if IEND sits in a chunk Type field.
PNG also has a CRC for each chunk. The CRC checks the Type and Data fields, not the Length field. It can find some forms of damage. However, it cannot prove that a found image is the same as the old one.
Copy and Check the Found File
After a tool finds the likely end, it copies the data. But a copied file is not always a good file.
It may have a valid header but lack later data. It may also have wrong size fields, broken records, or bytes from other files.
A tool can check the result in several ways:
- Check that key headers and fields are present.
- Check size values and file bounds.
- Check CRCs or other checks when the file type has them.
- Open or parse the found file.
- Compare its hash with a trusted copy, if one exists.
A file that opens may still be broken. Some apps can show part of a damaged image or document.
File Carving Techniques
Différent file carving techniques use different levels of file detail. A tool may use more than one method in the same scan.
Méthode | Comment ça marche | Limite principale |
Header and footer | Finds start and end patterns | A pattern may appear inside other data |
Size-based | Uses a known size or a size field | The size may be lost or wrong |
Layout-based | Reads fields, chunks, or records | Needs rules for that file type |
Content checks | Tests if the data forms a valid file | Checks vary by file type |
Fragment search | Looks for parts that may belong together | The right order may be hard to prove |
Header, Footer, and Size
These methods work best when a file type has clear start and end data. A tool can find a header and look for its end marker. It can also read a size field and copy that many bytes.
But an end marker may sit inside file data. A size field may also refer to one part of a larger file. If a tool reads the wrong value, it may copy too much or too little.
Layout and Content Checks
A layout-based tool reads the parts inside a file. For example, it can read PNG chunk sizes or check records in a ZIP file.
Content checks go one step further. They test whether the parts form a file that makes sense. These checks can cut down on false matches. Still, they cannot bring back bytes that are gone.
A file may pass some checks and still differ from the old file. These checks raise trust in a result, but they do not prove that it is the same file.
Find File Fragments
Fragment search tries to put split file parts back in the right order. It may use file rules, data patterns, and other clues.
Research from DFRWS on carving split files with object checks looks at ways to check and join file parts.
This work is harder than a basic signature scan. The result depends on the file type, the parts that remain, and clues about their order.
File Carving vs. Metadata-Based Recovery
The key difference between récupération de fichiers and metadata-based recovery is the data each method uses to find a file.
Comparaison | Metadata-Based Recovery | File Carving |
Main clue | File-system records and cluster maps | File signatures and data layout |
Old file name | May still exist in file records | Usually not found from file data alone |
Chemin d'accès au dossier | May still exist in folder records | Usually not kept |
Fichiers fragmentés | Can use saved cluster maps | Needs more clues to join parts |
Main need | Usable file records or maps | Readable data and known file rules |
Meilleure adéquation | File records still help find the data | File records are gone or cannot help |
How File-System Records Find Data
On NTFS, the Master File Table holds records about files. A file record can have data that tells the system where file content sits.
For data stored outside the file record, NTFS mapping pairs list data runs. They can show which clusters hold each part and the order of those parts.
Microsoft explains these records in its Master File Table guide et attribute record header guide. These pages cover NTFS version 3.
Other file systems use other maps:
- FAT32 uses FAT entries to link the clusters that hold a file.
- exFAT uses directory entries to describe file data. Its
NoFatChainflag shows whether a file uses one run of clusters or a FAT chain.
Les Microsoft exFAT spec sets out these rules. If these maps still work, a tool can use them to find split parts in the right order. This gives metadata-based recovery an edge over a scan that only looks for file signatures.
But good file records do not prove that the data is still whole. The NTFS Deleted File MFT Test shows why file records, data location, and file content need their own checks. For more on this method, see récupération des métadonnées du système de fichiers.
Raw Data Recovery Explained: Why File Names Go Missing
Récupération brute often means a scan that reads data without using the normal file and folder records. In many cases, it includes a scan for file signatures and file carving.
The term can mean different things in different tools. It is not a file-system standard. In this context, raw file carving recovery means finding files in readable data without using the old folder records.
Raw Recovery Without Original File Names
File systems keep file names and folder paths in their own records. Those names do not have to appear in the file data.
So, a tool may find a JPEG or PDF but not know its old name or folder. It may give the found file a new name instead.
PhotoRec says that it does not bring back old file names or folder paths. It finds files by their data signatures. See the PhotoRec guide.
Some details may still stay inside the file. A JPEG may hold EXIF data. A PDF may hold a title or author name. These details are not the same as the old file name or folder path.
Raw Recovery Is Not a RAW File System
The word RAW can mean two things:
- Raw recovery: A scan that reads data without using normal file and folder records.
- RAW file system: A volume that Windows cannot read as a known file system.
A RAW volume does not prove that all data is gone. The file-system records may be damaged, hard to read, or from a file system that Windows does not support.
A raw scan may still find data that can be read. But it does not fix the volume or bring back its old folder tree.
Encryption also matters. A BitLocker volume usually needs to be unlocked before a tool can read the files inside it. PhotoRec explains this need for BitLocker volumes.
Why File Fragmentation Limits File Carving
A file is split when its data sits in more than one run of clusters. A file-system-aware tool can use saved cluster maps to find each part. A basic carver may not have those maps.
Think of a file with three parts:
A → B → C
If the parts sit next to each other, the data order may also be A → B → C. A tool can read from A to C if it knows the right start and end.
Now look at a split file:
Storage order | Données |
Block 1 | A |
Block 2 | X (data from another file) |
Block 3 | B |
Block 4 | C |
The file occupies consecutive blocks. A sequential read can collect A, B, and C in order if the start and boundary are known.
Illustrative model only. A, B, and C are parts of one file; X belongs to unrelated data. The blocks do not represent physical NAND pages or a real disk image.
The file still needs A → B → C. But a scan from A may read A → X → B. It has mixed in data from another file.
So, a good header does not prove that the next blocks belong to the same file. The NIST file carving draft lists split data as a key issue for file carving.
Can File Carving Recover Fragmented Files?
Sometimes. If file-system maps still work, a tool may use them to find each part. Advanced carving can also use file rules and other clues.
But there may be many possible parts. The right order may not be clear. Compressed or locked data can make the job even harder because it hides clues in the data.
No one method can promise to rebuild every split file from its data alone. See Fragmented Files Explained for more on split files.
File Carving Limitations and Recovery Conditions
The result depends on how much data a tool can still read and how well it can find the file parts.
Limit | Pourquoi c'est important | Possible Result |
Données écrasées | New data takes the place of old bytes | Some or all data may be lost |
SSD TRIM | The drive may stop showing freed data | Old data may no longer be read |
Split files | Parts do not sit in a row | The file may be incomplete |
No clear end | The file has no safe end point | The tool may copy too much or too little |
False matches | The same byte pattern may appear in other data | A false file may be found |
Cryptage | The tool cannot read locked data | File signatures may not show |
Unknown file type | The tool has no rules for that type | The tool may miss the file |
Données écrasées
A tool can only copy bytes that it can still read. It cannot make old data from new data. Some parts may survive a partial write. Even then, the found file may be broken or lack key data.
SSD TRIM and Data That Cannot Be Read
On some systems, Windows can send TRIM or deallocation hints when file-system space is freed. These hints tell the drive that it can reuse those blocks. Microsoft explains this in its guide to TRIM and Unmap hints.
TRIM does not mean that every deleted file vanishes at once. The result depends on the drive and its setup. But once the drive has dealt with freed blocks, normal reads may no longer return the old data.
So, a scan cannot copy data that the drive no longer shows.
Locked Data and Unknown File Types
Locked data often hides the byte patterns that a tool needs to find a file. The tool may need the data to be unlocked first.
A tool may also find a file start but fail to read the rest. This can happen if it does not know that file type or a newer version of it.
So, no result does not always mean that no data remains. The tool may not know how to read what is there.
How to Check Carved Files
A match does not mean that a tool has found a full file. Check each result in steps.
Vérifier | What It Shows | What It Does Not Show |
Signature found | A known byte pattern is there | A full file is there |
File layout looks right | Some file rules match | All old data is still there |
File opens | An app can read some or all of it | It is the same as the old file |
Hash matches an old copy | Both files have the same bytes | The old name or folder |
Some file types use CRC checks. These can find some data errors. But a good CRC does not prove that a file is the real old file.
If you have a trusted copy, compare file hashes. A match shows that both files have the same bytes. If you do not have a copy, check the file layout, size, content, and whether an app can read it from start to end.
When Should You Use File Carving?
Carving can help when file-system records no longer show where files are, but a tool can still read some file data.
Common cases include:
- A damaged file system with missing folder records.
- Deleted files whose file records no longer help.
- A formatted drive that still holds old data.
- A disk image that needs a scan for file types.
- Files that a metadata-based scan cannot find.
If file records still work, metadata-based recovery may be a better first choice. It can keep old names, folder paths, and maps for split files.
Before you try to recover data, protect the source drive:
- Stop saving new data to the drive.
- Do not format, set up, or repair the source before you save key data.
- If the data matters, make a full drive image before more scans.
- Scan the image or use a read-only source when you can.
- Save found files to a different drive.
If the drive clicks, drops out, or shows major read errors, stop repeated scans. More reads may make a failing drive worse.
File recovery, file-system repair, and hardware repair are not the same job. Carving copies data that still exists. It does not fix a bad drive or rebuild a file system.
Conclusion
Sculpture sur lime finds and copies files by reading their data and file layout. It does not need the old file-system records. Its success depends on known file patterns, clear start and end points, readable data, and clues that show the right order of file parts.
A signature match is only the first step. File checks and tests help show if the result is whole and useful. If file-system records still work, they may hold details that a data scan cannot bring back, such as old names, folder paths, and maps for split files.
FAQ
Qu'est-ce que le « file carving » dans le domaine de la récupération de données ?
La technique de « file carving » permet-elle de récupérer d'anciens noms de fichiers ?
Le « file carving » permet-il de récupérer des fichiers fragmentés ?
La récupération « brute » correspond-elle au système de fichiers RAW ?
La récupération de fichiers est-elle possible après le formatage d'un disque dur ?
Le « file carving » permet-il de récupérer des données qui ont été écrasées ?
La fonction TRIM des SSD empêche-t-elle la récupération de fichiers ?
La récupération basée sur les métadonnées est-elle plus efficace que l'extraction de fichiers ?
Vasilii est un spécialiste de la récupération de données qui possède une dizaine d'années d'expérience pratique dans ce domaine. Tout au long de sa carrière, il a résolu avec succès des milliers de cas complexes impliquant des fichiers supprimés, des disques formatés, des partitions perdues et des systèmes de fichiers RAW. Son expertise couvre à la fois les méthodes de récupération manuelle à l'aide d'outils professionnels tels que les éditeurs hexagonaux et les solutions automatisées avancées à l'aide de logiciels de récupération. La mission de Vasilii est de rendre accessible aux professionnels de l'informatique et aux utilisateurs quotidiens des connaissances fiables en matière de récupération de données, afin de les aider à sauvegarder leurs précieuses ressources numériques.
