Where are deleted file saved from hard disk?

When a file is deleted from a computer’s hard disk drive, the data contained in the file is not actually erased from the physical disk. Instead, the reference to the file’s data in the file system’s index is removed, marking the blocks of data previously allocated to that file as free space available for future data storage. The file appears deleted to the user, but its data still resides on the physical disk until it is overwritten by new data.

Why deleted files can be recovered

When a file is deleted, the operating system simply marks the space that file occupied as being available for use. The actual data remains on the disk until it is overwritten by new data. This allows deleted files to be recovered by forensic software as long as the original data has not yet been overwritten. Some key points:

  • The data is still there until overwritten by new data.
  • The space the file occupied is now marked as available for use by the OS.
  • Forensic software can scan the disk and recover deleted files by looking for data that has not yet been overwritten.

Where exactly is the deleted data located?

The specific location of a deleted file’s data depends on how the hard disk is organized. Most hard disks are divided into clusters or blocks of storage. When a file is saved to disk, it gets allocated a number of clusters to store its data. When deleted, those clusters are simply marked as available again for reuse. The actual data remains in those same clusters until overwritten. So recovered data is found in the same physical locations where the file originally resided.

Common hard disk organization schemes

  • FAT/FAT32: Disk space is divided into clusters. Each file occupies a chain of clusters. When deleted, the chains are broken and clusters are marked available.
  • NTFS: Also uses clusters to store files. Maintains more detailed metadata about each file, but deletion works similarly.
  • EXT4: Common Linux file system. Uses inodes to track files and block groups divided into blocks.

In every case, the deleted file’s contents remain in place until the clusters/blocks are reused for new data. The original locations can be scanned for recognizable file signatures allowing recovery.

Challenges in recovering deleted files

While it’s generally possible to recover deleted files from a hard disk if the original data remains intact, there are some challenges:

  • Overwritten data: If the deleted file’s data clusters/blocks have been reused and overwritten, the original contents will be at least partially lost.
  • Fragmentation: Heavily fragmented files may have data scattered across the disk, making full recovery difficult.
  • Corrupted metadata: File systems rely on metadata to track files. If crucial metadata like inodes or FAT chains are corrupted, recovering filenames and directory structure can be problematic.
  • Disk errors: Physical disk problems may make it impossible to read some sectors where file data is stored.

Best practices for maximizing recoverability

To improve the chances of successfully recovering deleted files:

  • Avoid continuing normal use of a disk with deleted files you want to recover. More activity increases the risk of overwriting.
  • Use forensic recovery tools as soon as possible to minimize potential overwriting.
  • If disk clusters/blocks have been reallocated, recovery becomes less likely over time.

Can files be recovered after reformatting a disk?

Reformatting a hard disk is often thought to erase all data, but that is not necessarily the case. As long as the physical magnetic regions storing the original 1s and 0s of the data are not overwritten, recovery is potentially possible. However, reformatting does complicate matters.

Issues with recovering data after reformatting

  • The file system metadata will be erased, making it harder to reconstruct files and original directory structure.
  • Previously occupied clusters/blocks may get reused more quickly after reformatting.
  • The disk may appear empty and be put back into active use, increasing risk of overwriting.
  • Older versions of reformatting tools did a more complete erase, decreasing recoverability.

While recovery after reformatting is sometimes possible, the likelihood decreases significantly. Immediate action using forensic tools offers the greatest chance to recover data.

Can overwritten data ever be recovered?

With traditional hard disks, overwriting data generally makes it unrecoverable. However, there are a few scenarios where recovery of overwritten data is theoretically possible:

  • Magnetic force microscopy: This specialized technique can potentially detect and image traces of previously written magnetic data.
  • Differential analysis: If some of the overwritten data remains intact, it may be possible to infer other overwritten areas by comparing it to the new data written in its place.
  • Drive reallocation: If a disk block goes bad after overwriting, the contents may get rewritten to a spare block, with the original potentially recoverable.

While recoverability in these cases is highly situational, they illustrate that overwriting alone does not always make data irrecoverable. However, these techniques are expensive and used mainly by government agencies, if at all.

Recovering data from solid state drives

Solid state drives (SSDs) store data differently than traditional hard disk drives (HDDs), presenting unique recovery challenges:

  • SSDs use flash memory cells instead of magnetic disks. Cells must be erased before rewrite, but erasure is done in entire blocks.
  • Unallocated blocks on SSDs appear empty but may contain stale page data until rewritten.
  • TRIM commands and wear leveling make data overwrite on SSDs more complex and randomized.
  • SSD controllers and firmware manage what data is actually stored, affecting recoverability.

While recovering deleted files from SSDs is possible, overwriting data makes it significantly more difficult compared to HDDs. The complexities of flash storage introduce more scenarios where data appears deleted but fragments may remain recoverable.

Best practices for recovering SSD data

  • Avoid continued use of an SSD with deleted files to prevent increased overwriting from TRIM and wear leveling.
  • Use specialized SSD recovery tools and techniques instead of traditional HDD recovery methods.
  • Recovering data after reformatting an SSD is extremely difficult due to reallocated blocks and metadata loss.

Can files be recovered from the recycle bin?

When files are deleted on most operating systems, they are sent to a recycle bin or trash folder. While the data remains intact there, recycle bin recovery has some advantages and disadvantages compared to undeleting files directly from the original location:

Advantages

  • Files may be easier to identify and restore to original folders.
  • Less risk of data overwriting compared to marked as deleted files still on disk.
  • Requires less technical skill than forensic file recovery methods.

Disadvantages

  • Space limits on recycle bins mean older files will be permanently deleted.
  • Files may become fragmented or corrupted as more are deleted over time.
  • Recycle bin does not retain original directory structure.

While the recycle bin provides an easy way to recover recently deleted files, it is not a foolproof method. Older files get purged, and fragmentation can still occur. For best results, recover files from the recycle bin as soon as possible after deletion.

Can formatting or initializing a disk help with file recovery?

In some cases, formatting or initializing a disk may actually improve the chances of file recovery, rather than making data permanently irrecoverable. Here are some examples:

  • Fixing filesystem errors: If filesystem metadata like FAT chains or inodes are corrupted, reformatting may clear errors and make recovery tools more effective.
  • Clearing malware: A disk format can help wipe malicious programs so backups and scanned images can be safely restored.
  • Resetting partition maps: If the partition table or boot sectors are corrupted, an initialization is required before files can be extracted.

The key point is that while formatting or disk initialization erases file system structures and marking all space as available, the actual data still remains on disk until overwritten. So while riskier than recovering data pre-format, successful file recovery is still possible in many cases if the magnetic bits encoding the raw data are undisturbed.

Can files be recovered after a disk quick format?

A quick format is faster than a full format, but less secure when it comes to preventing recovery of deleted files. During a quick format:

  • Only file system metadata like FATs or inodes are erased and created fresh.
  • Existing data on disk blocks/clusters remains unchanged.
  • Free space is not securely wiped of any previous contents.

Since a quick format leaves all user data intact in its original physical disk locations, recovery tools can often successfully undelete files unless that data gets overwritten after the format. However, fragmentation and loss of metadata makes recovery less convenient than before the format. Full formatting wipes free space, further complicating data recovery.

Maximizing recovery after quick format

To maximize recoverability of files after a quick format:

  • Avoid additional disk writes as much as possible to prevent data overwriting.
  • Use file recovery tools immediately to take advantage of intact data.
  • Be prepared for increased fragmentation and absence of original filenames/directories.

Conclusion

While deleting a file may seem to remove it permanently from a hard disk, modern operating systems simply unlink file data from the directory structure. Until new data physically overwrites the disk clusters occupied by a deleted file, recovery remains possible using forensic tools to scan for signatures of original file types and metadata. However, recovery becomes more difficult over time as overwrite risk increases. The chance of recovering a deleted file largely depends on how quickly and intelligently restoration is attempted, particularly before potential reformatting and repartitioning.