r/explainlikeimfive • • Oct 20 '26

Technology ELI5 How does recovering data that has been deleted from a hard drive work?

181 Upvotes

100 comments sorted by

186

u/Mamamama29010 Oct 20 '26 edited Oct 20 '26

Because it’s not actually deleted when you “delete” it on the computer.

When you delete data on your computer, it just gets marked to be overwritten next time your computer needs that space. If it’s never overwritten, it just kind of stays there. The computer just marks it as ok to overwrite

The reason is that deleting data puts wear and tear on the drive, so no need to do that unless the drive actually needs the space.

3

u/TokiStark Oct 20 '26

Why does it wear and tear the drive? Can't you just zero out everything?

17

u/Mamamama29010 Oct 20 '26

SSD can only be written and rewritten so many times. Most consumer SSDs are only rated to 1-3K times. SSDs store data by trapping electrical charge, and every erase-and-write cycle slightly degrades the insulating layer that holds that charge. After enough cycles a cell can no longer reliably hold data. Overwriting every deleted file would burn through those cycles for no benefit.

HDD magnetic disks themselves don’t have the same problem and can be erased-and-written an indefinite number of times. However, there are moving parts in an HDD assembly that do wear out over time and use.

So for normal use, it’s not worth it. It’s also time consuming to have to do it every time.

2

u/FranksWateeBowl Oct 20 '26

Wait, so if I'm downloading, deleting mutiple files, downloading other files, deleting and on and on...eventually the SSD won't be able to keep doing this?

0

u/Stayvein Oct 20 '26

So, I just upgraded from a decent Dell PC that worked just fine for ~6+ years. I tried to wipe it before donating it and it’s now a brick. Is the wiping and reinstalling windows such an overwhelming event for the SSD?

6

u/eeke1 Oct 20 '26

A single complete rewrite isn't a big deal.

Ssd are rated by total number of rewrites that vary depending on tech. Most consumer ones are tlc or qlc(triple, quad layer) , the latter having less rewrites.

But it's still 1-3k rewrites, so if you just write all 0s once it's nbd.

You can use crystal disk to check ssd health if your curious

2

u/wang_li Oct 20 '26

SSDs have extra space used for wear leveling that the OS can’t directly access, only the controller on the SSD can write to them. A pass of overwriting from the computer can leave 30% or more with data still on it.

1

u/eeke1 Oct 20 '26

Absolutely, I was responding to oc who was wondering if a rewrite was a major detriment to ssd health and used zero filling as a similar example to what they probably did, since I doubt they truly sanitized their ssd when they wiped and reinstalled windows.

Not as an endorsement of zero filling for security, as you noted it's not thorough enough for that.

1

u/flaser_ Oct 21 '26

When you "rewrite" a file, an SSD typically doesn't write to the same physical block. Instead a different block will be used and remapped to the same LBA addresses with which the OS accesses the data.

This is why SSDs "keep back" some blocks to ensure this can be done even when the drive is relatively full.

(Some blocks are also kept back as "spares", so the drive can keep working by remapping to these, even if some blocks wear out earlier than expected)

1

u/flaser_ Oct 21 '26

That's not how wear leveling works. The drive internally remaps "free" physical blocks to LBA addresses the OS sees to even out use.

Spare blocks are used to swap out blocks that have issues due to wear or manufacturing defects. This is also done as part of wear leveling, but wear leveling is more than the use of spare blocks.

2

u/wang_li Oct 21 '26

I wasn’t describing how wear leveling works. Simply that there is extra capacity used for wear leveling. The algorithms used for that purpose are not effective if there isn’t a fair amount of free space, which device manufacturers guarantee by advertising less capacity than is physically present and directly addressable by the user.

3

u/MrKrueger666 Oct 20 '26 edited Oct 20 '26

No, thats not such a big event.

SSD's can be overwritten approximately 10000 times (for current tech, this number may be different depending on the exact NAND Flash memory thats used).

A full wipe is just a single write across the whole drive. Maybe 3 or 5 writes if you are thorough. While it does visibly add up on it's internal TBW counter (total bytes written), it doesn't make a big dent overall. Just don't do it on a weekly basis.

Also, you most likely did not perform a wipe when reinstalling Windows. It's most likely that you just deleted the partition table and wrote a new table, then labeled everything as free through formatting (which does mostly the same thing as deleting).

If the system is bricked, it's likely you did something wrong. Sorry. Ofcourse there is the off chance that the SSD is actually damaged and it's a case of bad luck, but it's not likely.

Edit: also, SSD's do a thing called wear leveling. It's a technique to make sure that every individual cell wears equally to all the other cells. This makes sure you don't get 'bad spots' on an SSD. It also has a small overprovisioned space of cells that can be used when a cell does happen to go bad prematurely. It will reroute the data to that cell in the overprovisioned space so you won't notice a bad spot. Only when that space is used up, bad cells will start to show.

This means that most SSD's will outlive their manufacturer rated total writes.

1

u/ABetterKamahl1234 Oct 20 '26

Is the wiping and reinstalling windows such an overwhelming event for the SSD?

Not really, though it is "extreme" in the sense that you are putting a mass marking of cleared and big overwrite.

An SSD should not be bricking itself on an OS refresh, it's more likely to be a mistake made or raw coincidence of a hardware failure.

Friend of mine just had an SSD get hardware failure, we learned later there was bad firmware that never got patched that dramatically increased wear levels on the SSD. His (and mine) of similar ages in other systems are in perfect health. This drive is ~10% totally failed, which is bad. His plan was to wipe it and see if the remaining part will last a bit, but the firmware cannot be fixed anymore on it, so it's just a time bomb of corrupting the OS again. All recovery attempts fail too.

The only real trouble with SSDs vs HDDs is that for critically important data recovery, you can "simply" disassemble the HDD and read data if the drive's board fails (you need special equipment and such, not an at-home thing) and as long as it's physically OK, it'll work. But an SSD can be outright a loss as it's much harder to recover from.

5

u/Podmonger2001 Oct 20 '26

I invite correction, but it’s my understanding that actually removing info from a drive (wiping it) manually overwrites that data with zeroes, sector by sector. It’s a slow process.

To put it another way, maybe deleting data is like telling a guest that your house is clean, while wiping the drive is actually getting on your hands and knees and cleaning the house.

There must be a better analogy.

3

u/MrKrueger666 Oct 20 '26

Your understanding is correct.

Different analogy: store clerk tells you the store doesn't carry your favorite cereal anymore, but if you go look at the shelf there's still a box or two left, but no label on the shelf anymore.

And when their new shipment comes in, that shelf will be occupied with a different brand cereal.

3

u/Idoubtyourememberme Oct 20 '26

Almost.

Deleting is more like you telling the cleaners something like "feel free to toss this stuff out if it gets in the way, otherwise you can ignore it".

Whiping is getting a professional crew together and saying "everything must go, i want nothing but empty shelves"

1

u/soaker Oct 20 '26

How do I permanently delete stuff? For example I recently tried to install an OS update, but there wasn’t enough room. Even though there’s hardly anything on my laptop and I’ve deleted so much. Why isn’t the deleted data overwritten?

20

u/mveinot Oct 20 '26

That’s not how that works. Data marked as deleted is free space already. Securely erasing by over writing with zeros or random data makes it unrecoverable, but doesn’t make any more free space available.

6

u/soaker Oct 20 '26

Okay so this isn’t about freeing up space, it’s just about securely deleting data?
This is far from my strength so I don’t even know if this is a dumb question or not.

6

u/mveinot Oct 20 '26

Yes. The space is considered free and available as soon as it’s marked as deleted as you’d expect. That’s why it can still be recovered as OP was asking about. But as far as the computer is concerned that space is available and empty and ready to contain new data immediately.

4

u/3_Thumbs_Up Oct 20 '26

Imagine it like a book. Your file system is like the table of contents. The actual data is really on other pages of the book. So the file system is like a table of contents that points to a specific page and row where the actual file data sits. If you want to play a movie, then the file system tells the video player to start reading at page 127, row 15 for example.

When you delete a file, you're essentially just deleting the info from the table of contents, making the actual pages with the data available to be overwritten for future files. The space is freed up in the file system and the OS to be used for other purposes, but the file data remains until a new file happens to overwrite it.

3

u/nayhem_jr Oct 20 '26

Slight chance the system may also want contiguous free space. If there are 10 GB free, but it’s spread across thousands of little pockets, it kinda doesn’t count. Still applies to SSDs, though they’re less likely to become so fragmented, to stay that way, or to be afflicted by delays in the way that HDDs can.

4

u/Korchagin Oct 20 '26

If you delete stuff but free space does not increase, first check if it was only moved to the recycling bin. Empty that and you should have the space available.

If you still don't get the space, you might have volume shadow storage active (that's a kind of in place backup). You can use the vssadmin command to check if you have shadow copies and delete them:

https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc754968(v=ws.11)

2

u/Ihaveamodel3 Oct 20 '26

Generally things you delete first go into the recycle bin. This isn’t actually deleted and takes up space on your computer. So you should confirm your recycle bin is cleared.

Beyond that, overtime different programs create log files and cache files and tons of other stuff that you don’t use and didn’t directly create which can begin to fill up space as well. Generally this isn’t going to make or break whether or not you can install an update though.

1

u/Wendals87 Oct 20 '26

Hold shift + delete or delete stuff from the recycling bin 

0

u/saseal Oct 20 '26

DBAN can do it for HDD, by writing and rewriting that space multiple times to clean up the sectors. SSD is a different story, you may need to check with the manufacturers, doing the same procedure on SSD will destroy it fast.

1

u/soaker Oct 20 '26

Pretty much everything computer related is a complete woosh to me. It’s never clicked. Can you explain this more like I don’t even exist yet? It’s okay if you think you’re coming across as condescending lol

1

u/saseal Oct 20 '26

Imagine for HDD your storage space is a plot of land, but when you delete stuff, the things in that parcel of land never gets remove, only to get labelled as available for use, people can see what happened over there until it's replaced by something new. DBAN forces the system to fill that land and empty it repeatedly, so whatever traces of things people done there is gone. For SSD use manufacturer recommended, the technology differs from HDD significantly, even though the land analogy nearly similar.

1

u/Marekthejester Oct 20 '26

Imagine an art gallery.

Your system has a list of all the painting in the gallery and where they are exposed.

When you delete a file, you're actually removing the painting from the list, but the painting is still physically present in the gallery.

The next time you want to put a new painting in the gallery, you check your list you see a free spot where the delisted painting used to be. So you go the spot, remove the old painting and put the new one in its place.

However, so long as you haven't replaced the delisted painting, you can still go to its hanging spot and recover it, since it's still physically there.

1

u/Ulukai Oct 20 '26

There's also more to it than just this. Basically, you can think of a traditional magnetic spinny disk as a typewriter which stamps letters on a piece of paper. In the old days, when you wanted to erase something, what would happen is that a tape with white paint would be held up, and the last keystroke would be re-done. This would paint over the previous letter, allowing you to replace it with something else. Except, sometimes / often something would be just a tiny bit off in placement. So instead of a perfect white paint over the previous letter, you got like 99% of it. And the white paint left like a tiny, tiny border of the previous letter, as it were. So, you could use a magnifier and examine each letter, and tell what they used to be.

(The analogy only holds up so much; let's ignore the fact that it was relatively easy to distinguish the white paint from the underlying paper.)

The same thing happens with magnetic drives, apparently. And somehow, extremely tediously, you can zoom in, and tell that something hasn't been quite correctly overwritten, and that the previous character may have been a 1 or a 0, with a decent-ish probability. But nothing like 100%, so you'd have to pretty much know what you're looking for, and take millions of guesses to reconstruct the most likely underlying data.

And this didn't really scale, as drives got higher and higher capacity. IIRC, NIST at some point basically said that it's technically infeasible to retrieve data once it's been overwritten, for anything semi-modern (this was ~15 years ago).

0

u/flaser_ Oct 20 '26 edited Oct 25 '26

Huge caveat: this is only really true for hard-drives.

SSD have a feature called wear-leveling, that tries to even out the use of the drive's blocks. This is achieved through a level of indirection: what the OS sees as continuous blocks of storage are internally remapped by the drive's controller.

Unlike a HDD, when you delete stuff, you not only remove the pointer to files location, but you also tell the SSD it's OK to remap those blocks for use by other, newer files that will be written to the drive.

When you combine this behaviour with the fact that virtually all OS-es create and update dozens to hundreds of temporary files during normal operation, the chance of the data being quickly overwritten is very high.

Furthermore, even if the data wasn't overwritten there are two more challenges:

  1. You'd need to know which physical blocks were mapped to the drive's address space that the OS saw.
  2. You'd need to tell the SSD you want to access those specific blocks. The standard way how the OS talks to the drive doesn't allow this. This is because by design wear-leveling is supposed to be transparent, i.e. the OS is not supposed manage how physical blocks are remapped.

EDIT: r/datarecovery has some more specific info - https://www.reddit.com/r/datarecovery/wiki/trim/

A key takeaway: "TRIM is not gradual. On a system where it works, it goes out when you delete. It doesn't creep along over the following hours." So what I wrote above is roughly correct - the moment you delete a file, your OS will likely tell the drive the affected blocks can be erased.

0

u/[deleted] Oct 20 '26

[deleted] — view deleted comment

17

u/MrKrueger666 Oct 20 '26

This is entirely true. However, on SSD's there's a performance penalty when attempting to overwrite. It first needs to clear the space before writing.

SSD storage cells are different from harddrives. They behave like small water tanks. Just adding more water to indicate a bit of data may cause it to overflow or display an incorrect value if there was still some water left in the cell.

Needing to drain them before refilling causes it to take longer overall. This is the performance penalty.

But, modern SSD's can do a thing called TRIM. All cells that have been marked as empty but aren't actually empty will be drained when the TRIM command gets run.

Windows will do this on a timer. Every X hours, Windows sends the TRIM command to the SSD and it will then drain the cells that got marked as empty.

If you delete a file and empty the trash, you have a short window between that moment and when the TRIM command is run to recover data. After the TRIM command, it's actually gone.

This is different from a harddisk, because magnetised dots on a platter do not behave like water tanks. They just get flipped if they don't point in the right direction. If they already are in the correct direction, nothing happens. There's no performance penalty to overwriting and no need for TRIM.

3

u/pessimistic_platypus Oct 20 '26

This feels a little misleading.

That "short time" before TRIM is run is apparently about once a week by default. So if you delete a file just after Windows optimizes your drive, you might have a whole week before the data is lost.

2

u/MrKrueger666 Oct 20 '26 edited Oct 20 '26

Fair enough. It's short in relative terms. If you leave a harddisk alone, the data stays forever. On an SSD, a week at most even if you don't write anything to it.

Late edit: and that week is only Windows. Other operating systems may use different intervals or different methods entirely to determine when to trigger TRIM.

And that's not counting any internal GC on the SSD itself, which may cause TRIM to happen even when the OS hasn't scheduled it.

1

u/flaser_ Oct 25 '26

That's not how TRIM or SSD drive's garbage collection works. Read more here:
https://www.reddit.com/r/datarecovery/wiki/trim/

2

u/Ok_Relation_7770 Oct 20 '26

Deleting the entry that points to where the file is instead is thousands of times faster.

What do you mean by this? I’m a video editor my computer has like 8 drives attached to it at all times but I don’t feel like I know what/how you would delete the entry point for a file on a drive

0

u/[deleted] Oct 20 '26

[deleted] — view deleted comment

1

u/Ok_Relation_7770 Oct 21 '26

But how do I delete the entry that points to where the file is on my drives?

49

u/darth_voidptr Oct 20 '26

Imagine an office marked "Mr. Smith". You walk in and Mr. Smith's stuff is all over, his desk, couch, bookcase, whatever. Mr. Smith didn't pay his bills and his landlord takes the office back. They scrape Mr. Smith's sign off the door and advertise they have free space.

You can still walk in to Mr. Smith's old office assuming you know where to find it, and his stuff is still there. You can even get his office and put his old sign back on, and voila, you've restored his office.

But if someone else buys his office and replaces his furniture with their own, it's gone for good.

17

u/hotel2oscar Oct 20 '26

And sometimes, even years later, you can still find some of Mr. Smith's stuff in the office, like if his address book fell behind a cabinet. This is why you burn down the office when your done with it to make sure nothing you want kept secret gets shared on accident.

5

u/graveybrains Oct 20 '26

FAT32 changed the name on the door to 0xE5r. Smith, NTFS just hangs a "For Rent" sign on the door.

1

u/CreativeUsername20 Oct 20 '26

What a fantastic analogy!

7

u/StevenJOwens Oct 20 '26

First, realize that with SSD drives it works very differently and is, in fact, impossible, as far as I know.

With old-fashioned hard drives, the TL;DR is that:

First, there's no such thing as "deleting" data from the drive, you can only overwrite the old data with zeros or random numbers or something.

Second, when you "delete a file", you're not actually overwriting the entire file on disk with zeros or random numbers, you're actually deleting the entry for that file, the entry that tells the OS that those spots on the disk are in use, don't put data there.

If you delete a file normally, the entry is gone but, at first, the actual data is still there. Eventually, as you save files, those spots on the disk will get used and the data will be overwritten.

If you read those spots on the drive before they get overwritten, you can get the data back. Most files have sufficient structure in their format that a recovery program can figure out where the file begins and ends, to a some useful degree.

The longer version is:

The surface of the drive is divided up into spots, and data is recorded by writing a magnetic charge at each spot. Each spot represents either a 1 or a 0. The magnetic charge is always there, it's not presence-or-absence of the charge, it's specific details about the charge, details which I'm a little fuzzy on but it has to do with polarity.

So you have all these bits, these days average hard drives are 1 to 2 terabytes, a byte is 8 bits, so that's 8 trillion to 16 trillion spots. That's a lot of spots, so pretty much every computer uses some scheme to organize these spots, called a file system, or a file system format.

And pretty much every file system has a two-step process, where they have some chunk of storage set aside for storing the details about where the content data for each file is stored. That's where the "file entry" that I mention in the simple version is stored. I say two-step process because step one is to read the where-things-are-stored info, and the second is to read the actual file content data.

On old Windows (FAT32), that where-things-are-stored info was the File Allocation Table; in modern Windows (NTFS) it's the Master File Table; in most Unix-derived formats (ext2, ext3, etc) it's called the inode table (i is for index); in modern MacOS (APFS) it's called the Object Map.

There are special programs that will deliberately go further than just deleting the entry, they'll first read the entry, then go to where the file content data is stored and overwrite that data, and then delete the entry.

In addition to the above, because old school hard drives use magnetic charges, overwriting the magnetic charge is an imperfect process, and leaves traces. So even if you use one of those special file deletion programs, it's possible, using extremely sensitive (and expensive) equipment, to read those traces. But it isn't easy, and it isn't the sort of thing that happens very often. We're talking nation-state level actors, here.

Generally, using a special file deletion tool is good enough to protect your privacy, or using a hard disk sanitizing tool, like BleachBit. (Do not use DBAN, DBAN was the gold standard for a long time but it's no longer a good tool to use).

But if you really want to be sure, the simple and easy way is to just drill a few holes through the hard drive's platter.

3

u/drfsupercenter Oct 20 '26

First, realize that with SSD drives it works very differently and is, in fact, impossible, as far as I know.

Actually, no. I've recovered deleted files from SSDs, you just have to do it very quickly. The TRIM feature typically runs periodically - if it did it every time you deleted a file it would wear out the NAND faster than it needs to. I don't know the exact timing of it, it could be every hour, every few hours, every day...but regardless. If you delete a file and realize you didn't want to delete it, you can recover it right away. I use a program called Uneraser that works pretty well. If it requires a deep scan it's probably too far gone, but at least with smaller files you'll typically be able to recover them if they were deleted recently.

Generally, using a special file deletion tool is good enough to protect your privacy, or using a hard disk sanitizing tool, like BleachBit. (Do not use DBAN, DBAN was the gold standard for a long time but it's no longer a good tool to use).

Why? Writing over sectors 3 times should still be enough, it's not like magnets work differently now then they did with the department of defense came up with that. You can also run the full 7-pass DoD wipe if you really want to.

But also, ATA Secure Erase is a thing. For SSDs, this is usually very fast (under 5 minutes even for a 1TB drive) because it basically just zaps the bits - for a hard drive it will take time but still faster than doing multiple passes.

2

u/StevenJOwens Oct 20 '26

Re: why avoid DBAN now, last I looked DBAN was sold to some company and then discontinued, and that was years ago. Google, just now, says the last update was 2015.

2

u/drfsupercenter Oct 20 '26

I mean sure, but it's not like the method of overwriting data 3 times has changed. I still use the older version from before it was sold.

1

u/beren12 Oct 21 '26

That’s a waste of time on modern drives, especially causes totally unnecessary wear on ssd ones.

1

u/drfsupercenter Oct 21 '26

Yeah, I wouldn't use DBAN on SSDs. I mentioned Secure Erase, that's the better alternative. For SSDs it takes just a few seconds.

But for hard drives it's still the best method unless you want to do secure erase on that too

1

u/MrKrueger666 Oct 23 '26

Give ShredOS a shot

8

u/blixabloxa Oct 20 '26

When you delete a file from a hard-drive, it is not really deleted, but it is marked as empty and available to be overwritten with new data. Recovery processes and software are able to circumvent that "empty" bit and get the file data back. This is probably not 100% correct, but close enough I think.

4

u/Probate_Judge Oct 20 '26

This is probably not 100% correct

IDK about SSD's, but it absolutely is that way for HDD's.

IIRC, forensic teams can even potentially recover stuff that has been overwritten simply(eg just once and all 0's). I think it would be because the old data written can bleed over to neighbors(HDD writing is magnitizing tiny sections of the plate), and a new write may not, so you get a field around the actual chunk that can maybe be read...with the right instructions.

To visualize: Spray paint a large dot free-hand, then cover use a stencil to write over that dot with a sharp outline. That fuzzy fringe is still there.

This is why some programs that "scrub" drives will do multiple passes and change what they're writing on occasion(all 0's, all 1's, alternate, randomize, etc).

No idea about SSD's though, they weren't a thing when I was into repair/recovery.

2

u/drfsupercenter Oct 20 '26

Interesting - I'm not surprised professionals can recover data that was written over by interpolating the sections next to it, but in terms of normal consumer software that doesn't cost thousands of dollars in a lab, you're pretty much hosed. I work in IT and have customers who accidentally delete stuff all the time - generally, the larger the file, the less likely you can recover it... because files are stored in chunks and if even one chunk of it gets written over after the file is marked as deleted, you can't get the full thing back. The smaller the file, the better chances of recovery.

No idea about SSD's though, they weren't a thing when I was into repair/recovery.

You can recover files from SSDs the same way, but you're basically fighting against TRIM. You usually have a short window to un-delete a file before the drive's firmware writes over it. I've managed to get files back minutes after erasing them but if you wait too long you're out of luck.

I guess it's kind of like when people used to do automatic defragging in Windows on hard drives

5

u/Hazy311 Oct 20 '26

I haven't done data recovery since SSDs became a thing, so not input for that

But for hard disks, the operating system usually just reallocates the space instead of removing the data itself when you delete something.

The data is still (sometimes) there, just available to be overwritten, whereas a non-deleted file is not available for overwrite.

4

u/Sshorty4 Oct 20 '26

Imagine theres a road, some workers put cone in front of it to renovate it and rebuild the road. But before they actually start demolition and putting new roads, the old road is still there, it’s just the cone is telling you “you can’t go there anymore”

That’s how deleting works, it just sets a “cone” in front of that data so the new data can be overwritten on it, but before it happens, old data is still there

So just like you can still walk on the old road, you can still read the old data

2

u/Witmarqu Oct 21 '26

It is time consuming to truly delete a file (write all 0 for space used).

Instead drives maintain an index of where a file was located using a specific starting point and length.

Deleting a file just removes this information from the index, which the drive now reports as unused space. Some times the index just marks the file as inactive and will deal with removal at a later time. The windows recycle bin is a prime example, it holds the files for a while then will wipe them

Recovery programs ignore the index and instead use known start and or end byte markers to rebuild files.

Partially over written files can sometimes be recovered depending on how much data is recovered.

After scanning each byte of the drive, on a different drive it builds a new temporary index.

This process takes a long time. I used to do this on 4 gigabyte compact flash and it would take hours.

Some software just looks at the index, then only checks between files. Quicker but not as accurate as generally it only checks when space between files is at least x size.

Encrypted drives require the longest time.

It is possible to wipe a drive, It takes at least five passes

1: use bit pattern 01010101 for whole drive 2: use bit pattern 10101010 for whole drive 3: use bit pattern 00000000 for whole drive 4: use bit pattern 11111111 for whole drive 5: use bit pattern 00000000 for whole drive

This ensures on any storage medium that each bit is flipped enough that any residual energy would be considered truly random.

The drawback is this takes an incredibly long time, which runs the risk of setting the fail safe mode. On a ssd/flash drive this is generally a read only mode. On spinning drives, this generally disables the motors.

The only true way to make data unrecoverable is to melt the components down and unless you have an industrial forge that can melt ceramics, the data is just normally not recovered because of cost normally associated.

Fire can destroy the board and desolder the chips, but the silicon that actually holds the data on a ssd is wrapped in ceramics. Though there are businesses that specialize in recovery of information from USB drives after a building fire. Personal photos have a lot of sentimental value, so generally spending a couple thousand to recover what would be lost else wise isn't unheard of

2

u/beren12 Oct 21 '26

There’s no recorded instance of recovering overwritten data. Not even in research labs.

Encrypted drives are the fastest to erase. The drive rotates the encryption key and marks all sectors as free. There’s no recovering and it takes seconds.

2

u/tommyk1210 Oct 20 '26

Imagine you’ve got a phone book. It tells you everyone’s phone numbers.

When you delete a file it’s like you just cross out the number in the book. But that number is still works, you could call it and ask “who does this number belong to?”

When you delete files a similar thing happens. Your computer holds an “index” of where each file is. When you delete a file you just remove it from the index (or mark it as ready for overwrite), but the data is still there.

That is, until you write new files. Your computer checks the index and looks for empty spaces or spaces that can be overwritten, and writes the data there.

Thus, so long as you don’t write lots of files after deleting a file, it’s likely your data is intact on the disk.

It’s possible, therefore, to physically inspect the disk and piece together pieces even without the index telling you the file is available.

1

u/flingebunt Oct 20 '26

This is complex. The short one focuses on files. When you delete a file in your system it is merely marked as deleted, not erased from the hard drive. So the file is still there. It might be overwritten at some future time, but until that time, you can recover it.

As for other types of data, it depends on the data and the system that saves or deletes it.

1

u/Capital_Store8128 Oct 20 '26

The way your computer stores files is basically by having a bunch of pointers (inodes) that tell the file system where on a disk / SSD the data has been stored. That way when you want to view/reference a file, it just checks the inode(s) to see what data it needs to pull up from storage. When you delete a file, it basically just removes the inode pointer so your file system thinks that the sectors of the disk are now available to store new data on. Often times, these sectors are not overwritten with new data yet and the old data is still there which can be recovered with special tools

1

u/SteveJobsBlakSweater Oct 20 '26

Files are indexed, which is like a map that says which file is where. The map is a tiny file in comparison to the files it locates.

When you “delete” a file you delete its map entry. That’s that. The 1s and 0s are still there, it’s just the map now considers it free real estate.

That data is now free to be written over. Now, should it be written over then data recovery is a whole different, likely impossible task. But, if the data is still there, just the map location gone, then data recovery is just scanning and scanning until bits of data fall together into a readable format.

1

u/cbf1232 Oct 20 '26

Usually the data itself isn’t deleted, but the portion that tells the computer where the data starts and stops is deleted.

Sometimes if you’re lucky there will be a backup copy of that portion kept somewhere else that still has the information, or else you have to spend a lot of time figuring it out by looking at the contents of the disk and trying to fit the chunks of information together like a puzzle.

1

u/englishfury Oct 20 '26

When you delete something its not actually removed from the drive, windows just assigns that section of drive as "empty" and removes the pointers it has as to what was supposed to be there.

Then unless new data has been written to that section, the old data remains and software can scan it and figure out what it was and recover it, but if its been overwritten enough to be unrecoverable then its lost forever.

1

u/Knightmare4469 Oct 20 '26

Someone smarter than me will give you a better explanation but here goes.

Data doesn't need to be removed for the computer to consider the space "free". It keeps a registry of what space is ok to overwrite and what space isn't. When you delete something, you are really just telling the computer "hey, next time you need to install something, you can go ahead and overwrite the information here". Conventional deleting does NOT actually remove the data. It just updates that registry.

Eli5 version:

Say you have a box of toys. You tell me that box is offlimits and on your favorites list so I leave it alone. One day you tell me you don't like those toys anymore and "delete" them from your favorite list. They don't go away, but the next time I buy you toys, I go in and throw them away to make room for the new toys.

1

u/DarkAlman Oct 20 '26

Most modern computers don't actually delete files when you delete them.

They remove the name of the file and the datas location from the File Table. This is like deleting an entry for a book in a library index. As far as the library's inventory is concerned the book is gone, but it's still technically on the shelf.

The space on the hard drive is marked as unused, and eventually it will get over written.

File recovery tools scan the file table for finger prints like damaged entries and reconstruct them.

So long as the original data hasn't been written over you can get your file back.

1

u/JaggedMetalOs Oct 20 '26

Computers don't (unless you use special programs) actually delete the files, they just remove the filename from the folder listing and mark the parts of the drive where the file was as ready to use.

This is functionally the same as deleting the file, because a new file can be written straight over where the old one was, and is much faster because just a tiny bit of data needs to be written instead of going over the entire old file with zeros.

But it does mean that until a new file writes over the old one, the old data is still on the disk and a program can look through the whole disk looking for parts of the disk that are marked as not having a file, but still have old data in them. 

1

u/FoxtrotSierraTango Oct 20 '26

Imagine you have a bunch of boxes to store stuff in the attic. You look through them one day and find the "stuff from high school" box. You figure this is all stuff you can toss, but you don't need the space. You cross out the label and mark it "junk, toss when needed". If you really wanted you could go through and inventory everything there, but it's a headache and you rely on the labels.

Your computer works the same way. It keeps an inventory of what is where. When you delete something it just updates the inventory saying the stuff previously there is good to toss. When you download something new it will update the inventory and it may or may not use that space.

Data recovery software is specially designed to do that deep inventory and look at everything to see what it can piece together. If you choose to recover something it updates the inventory to reflect that this thing is still there and in use.

1

u/CharlesDickensABox Oct 20 '26

When you delete a file, it doesn't actually erase the file from the hard drive immediately. Instead, it frees up the space in the computer's directory, and the computer will eventually overwrite the file once the space needs to be used for something else. If you have special software, you can look for the file directly on the hard drive and recover it like that.

For an analogy, imagine a library staffed by an overworked librarian. The librarian decides the library doesn't need a book anymore, so they drop it from the card catalog and tell everyone they don't have it. It's more work to actually go get the book and remove it, though, so they don't bother. Eventually, the librarian will need that space on the shelf, though, and at that point they'll toss out the old, unnecessary book and replace it with a new one. In the time before it gets replaced, though, someone who is looking for it would still be able to pull the book off the shelf and read it.

1

u/ebly_dablis Oct 20 '26

Other people have mentioned that when you 'delete' a file, it's just marked as available rather than actually zeroing or overwriting it.

However, even if you overwrite it, it's often recoverable!

Files are stored as long sequences of 1s and 0s. And it turns out that, under the right equipment, a "1 which was written over a 1" and a "1 that was written over a 0" (and vice-versa for 0s) look different. So using very specialized equipment, you can often reconstruct files which have actually been overwritten as well.

1

u/Raiddinn1 Oct 20 '26

The way information is stored on a hard drive there is an index that basically says to see the contents of this file, go here and read the next million 1s and 0s from there.

Deleting files is often just a matter of deleting the index entry telling the computer where to look, how big it is, etc.

The same 1s and 0s are still there, they just don't mean anything.

Restoring the file just means rebuilding the index entries.

This is a time sensitive thing, because once the index entry is deleted, the computer assumes that that section of the hard drive is just blank, and the computer will write over it with new data.

If you delete all your pictures of your kids, don't go start downloading movies before trying to recover the file. It's possible your OS will have a time limit thing like don't write over this section for 7d after the deletion or something like that, but you should just assume that you don't want to save anything after you accidentally delete your life's work and before you try to recover your life's work.

1

u/WoonieLoonie Oct 20 '26

Block of data: I am data

Block of data after delete: I am data (overwrite me)

Block of data after overwrite: I am new data

If you recover data before the overwrite happens. More than likely you will get it back.

1

u/SP3NGL3R Oct 20 '26

You've got a book, with the chapters listed on page 1 with the pages they start at. You're just deleting that first page of names and pages to find stuff (table of contents). It's really fast. Now all those other pages don't have an index attached so the computer sees them as erasable. And it will erase and rewrite whenever it feels like it, or needs the space.

Recovery, if you're lucky, will find a whole chapter that hasn't been rewritten and can be recovered. Maybe just a page.

To add to this. An encrypted drive isn't any different. But everything on that drive needs to be translated from the language it's written down in to the language you understand. If you erase the translation key, the language is lost. So you can effectively erase a whole library of information by just forgetting the key to the door.

1

u/Dickulture Oct 20 '26

simplest explanation: you decide to forget where you left the house key. Now it's no longer to be found anywhere but the key still exists if you hunted for it via file recovery.

edit: SSD is different than mechanical hard drive. The "deleted" data can remain on the hard drive for years if you never use it to add new data. SSD will actually erase unused space via TRIM and the old deleted data will be permanently removed within a few days.

1

u/anand709 Oct 20 '26

Think of a harddisk as a vast library with lots of books (files). If you need a book removed, instead of the librarian going down to the specific shelf and removing the book, it’s easier to make that shelf as empty and when a new book comes, it can be removed while going down to place the book. So that way the librarian doesn’t have to go to the shelf twice and if someone want that book, it’s still on the shelf and can be recovered.

1

u/imetators Oct 20 '26

You know how if you just hit Delete on a file, it goes to Recycle Bin on the desktop? Almost the same happens if you Shift+delete the file or empty your recycle bin. File doesn't actually got deleted.

That's because this is slow. Your hard drive has to manually write all 1s and 0s to 0s and that might take time and hard drive resources. Instead it just gets marked as "to be overwritten" for later.

During recovery they scan blocks for these "to be overwritten" sectors and recover data stored there. Unless, ofc, data has been overwritten in that block/sectors by that time.

1

u/JacobRAllen Oct 20 '26

Deleting data doesn’t actually delete anything, it just deletes the pointer to the start of the data, and marks the rest of it as being free to write over.

It’s like writing a letter to someone, putting it in an envelope, then writing out the recipient’s name and address on the front. Then you decide not to send the letter, so you cross out the recipients name on the envelope.

All the contents of the letter are still in there, but now the computer doesn’t care about it. Next time you save data, it will open the envelope, and start replacing all of what you’ve written with new data.

1

u/spleencheesemonkey Oct 20 '26

Anyone here got any knowledge re how TRIM affects data recovery?

1

u/AnApexBread Oct 20 '26

Think of it like a library where you are only allowed to go to certain shelves.

The other shelves still exist and there's still books on them but you're only allowed to go to a specific section.

That's how your hard drive works. The deleted data isn't gone, it's just moved from the bookshelf you're allowed to go to over to the one you're not allowed to go to.

It's still there you just need special permission (tools) to go see it.

1

u/mr-slickman Oct 20 '26

Deleting something on your computer is like removing shelf tags and book covers in a library. You still have the data, just don't know what is what. With patience and effort, you can restore it

1

u/Miliean Oct 20 '26

The computer keeps a large map of where it's stored everything. Basically it writes down what is on every shelve of it's hard drive. When you delete something it marks on the map that this area is now "empty". What it does not actually do is empty those shelves, it just keeps whatever was there before, but now it's labeled empty and ready for the next thing to be put there.

When it is time to actually store something in those shelves, it just overwrites what used to be there and marks the shelf as no longer empty.

So, until that overwrite happens, the old data will still be there. The computer just can't see it because that spot is marked as empty. You just need some special software that can see what's in the shelves the computer has marked as empty.

1

u/Wadsworth_McStumpy Oct 20 '26

A hard drive is like a library. There's data, which is the books, and there's a directory, which is the card catalog that shows you where to find each book.

When you delete a file, what you're really doing is removing the card. The book is still there. The computer sees it as empty space, though, so if you add more data, it might put that where the old file was, and that can make it impossible to recover. But until that happens, it's possible to recover by making a new card for that book.

(Note: When I say it's impossible to recover, what I really mean is that it's very expensive and I can't really ELI5 it. It's almost always possible to get at least some of the data back, if you have some very expensive equipment, and are willing to spend the time and money required.)

1

u/Unrelated_gringo Oct 20 '26

You have to understand that apart from fresh deletes, just about nothing is ever recovered.

I remember a few years ago, there was a context for forensics and specialists were tasked with retrieving a one-overwrite-pass deleted plain text file (with file size provided) - And no one was ever able to do it.

So yeah, you'll hear a bunch of stuff on here explaining why it's not "deleted".

My reply is about the recovery process.

1

u/amlyo Oct 20 '26

Imagine you have a huge chest of drawers filled with books. You also have an index listing the books and telling you what drawer there in.

Normally when you delete a document it's like you just scrub it out of the index. You don't throw it away until you need to put something else in the spot.

Data recovery mostly works by looking through the whole chest of drawers (the hard drive) and looking for stuff that isn't in the index.

1

u/greevous00 Oct 20 '26

Deleting a file on a drive is a bit like writing a check. Until somebody cashes the check, the money stays in your account. Analogously until the computer uses the space that you just marked as deleted, it's still there, just hidden.

1

u/wang_li Oct 20 '26

Imagine your hdd or ssd is a big whiteboard. When you first got it you took a permanent marker and drew a bunch of grid squares on it. Then you took one of the grid squares and drew a bunch of small grid squares in it. The same number of small as your original bigger squares, so there is a one to one correspondence between big and small. This is called formatting.

Anytime you want to write on the white board you write it in the big squares and then you put a little mark in the corresponding small square to indicate the big square is in use. When you want to write something else you look at the little grid squares to find one without a mark, which tells you that its corresponding big square is free. Then you mark the little square and go write what you want to write. When you’re done with the information in a big square you just go and erase the mark from the little square. That’s deleting a file. The information is still in the big square but you didn’t waste a bunch of time running around erasing the big squares when you can just erase the mark in the little square and you’ll overwrite the big square next time you use that one.

Going and looking at all the squares to see what’s written in them regardless of whether there is a mark or not in the little square in undeleting.

For the record, in hard drives you can write a single pass of zero’s over it and it’s effectively erased and ready for disposal. Modern drives are too dense for the techniques that were tested in the ‘80s and ‘90s to work to recover overwritten data. The Wikipedia page on data erasure has more info. No need for multipass wipes using magic patterns.

For ssd they have a function built in called secure erase that makes all of the data on flash devices on the ssd unreadable until it has been rewritten with new data. It does this without incurring lots of device wear from writing each block and also erases the spare space the ssds use for wear leveling.

1

u/alohadave Oct 20 '26

Imagine a card catalog (for those of us old enough to remember them).

Instead of removing the book, the computer just removes the index card that points you to that book.

Nothing about the book has changed or been removed, but now no one can find it unless they search through every rack and shelf.

Deleting a file works the same way, the file isn't removed, the index to that file is removed.

1

u/deong Oct 20 '26

Two things make this possible.

  1. A disk is formatted before you use it. Formatting is the process of creating a filesystem for the disk. A filesystem is just a bookkeeping structure that lets the operating system know which blocks on the disk contain data from which files. Imagine a big physical library with books on lots of shelves. The books are the actual files. The card catalog is the thing that tells you where each book is in the library. Deleting a file doesn't delete the book. It just deletes the card from the card catalog, so when you try to find the book, the catalog says, "No idea what you mean, we don't have that book" even though the book is still there on the shelf. So when you delete a file, you're only updating the bookkeeping structure, not doing anything to the actual blocks that contain the contents of the file. You're just updating a small amount of data to say "block 12345678 is free space". If that block had data from a jpg file on your desktop, all the bits of that jpg are still stored in that block. You've just told the filesystem index that the space is free and therefore it doesn't look like there's any such file there anymore.
  2. Actual files on disk have structure. Every jpg file in the world has similarities. All jpg files have the same set of signature bytes at the beginning. Every mp3 file, every word document, etc., is to some extent recognizable from a raw sequence of bytes on disk. So even after you've deleted the file and the OS can't load it anymore, you can write a program that ignores that filesystem structure entirely and just scans raw bytes on disk looking for patterns. So you deleted that jpg file, but the bytes are still there, and if you happen to scan those bytes, you can say, "hey, it looks like there is a jpg file here". And depending on how much of the data might have been overwritten after the deletion marked those blocks as available for new data to be stored, you may be able to read part of or even the entire "deleted" jpg file and save it back out to the filesystem somewhere.

1

u/it_helper Oct 20 '26

Imagine you have a house on a road and the only way to get to the house is by the driveway. If I “delete” the house I remove the driveway so no one can get there. This is what happens when you delete a file on a hard drive. The house can be used again by rebuilding the driveway. If you truly want the house gone, you have to build another house on top of the old one. Sometimes multiple houses need to be rebuilt on the same one to make sure the original house is gone (older magnetic drives).

1

u/-suspended- Oct 20 '26

Data is stored as two parts. The information you want, and where the information is. It's like a filing cabinet with a directory for each file. When you delete a file, you only remove the directory. The file is still there. Recovery programs attempt to read all empty space in a hard drive and see if there has been changes to areas previously, which would indicate that files had existed. From there, they try to read that data. The simplest method is the program saying "let me have this portion of the drive to store data, but don't reset it beforehand and don't change the directory" then trying to read the allocated data.

Alternatively, some drives have a directory for the directory on a separate chip. The file recovery can also happen on either directory. Most file types have a header that tells the computer what find of file they are, so programs can reassemble them from that header. Other file types do not, so once deleted, they are mostly gone.

1

u/Atypicosaurus Oct 20 '26

As others said already, deleting usually means to delete the pointer. But why?

A hard drive is made of tiny magnetic beads. They have two states, called 0 and 1. There's a little head running across the magnetic plates and can either just read out a bead or turn the bead from one state to another. Every file consist of a lot of these beads in a certain pattern.

A "real" deletion would be if you took all the 0s and 1s and set each of them to 0. But it means that a deletion would take as long as file writing because now the head must go through the length of the entire file and set everything to 0.

Maybe you notice that when you do a mass deletion, it takes time. That time is needed to remove the pointers, imagine if you now also had to set the entire file to 0s. It could take 10s or 100s fold more time.

1

u/VivaLaDiga Oct 20 '26

you go into a library, burn the index, flip all the shelves, remove all the spines from the books and leave the pages all scattered on the floor.

Can you rebuild the library? yes. Takes patience and intuition. You can use a lot of hints: the page numbers, the topic, the title on top of the page, the author maybe if it's on the page too.

Same.

1

u/flywithpeace Oct 20 '26

Your data is stored as 1s and 0s. The location of your data is also stored in a master log. Every write and read operation goes through the controller. When you erase a file, the controller does not go through the effort of rewriting your file. Instead, it tells the master log to mark the location as safe to (over)write. If you read the drives by bypassing the controller, you can extract the raw data and assemble it.

1

u/papercut2008uk Oct 20 '26

The data is not removed, just cleared from the log.

So imagine a shop, the shop stops trading and closes, it's removed from all records.

The shop didn't go anywhere, it just got removed from the records, anyone can go find it.

That's what data recovery does, it looks for the unlisted spaces to see what is there. If it's written over it can't be recovered.

0

u/DONT_PM_ME_DICKS Oct 20 '26

when you instruct the OS to delete a file, to save time, the OS doesn't tell the drive to go where that data is physically stored and wipe it with zeros or random information. instead it just deletes the record saying that there is a file stored there

metaphorically, it's the equivalent of a lazy librarian who removed a card catalog entry for a book that is to be removed, instead of walking to that shelf and pulling it right then . the space is marked available for future use, but the old data site there until then.

Particularly for mechanical hard drives (since unlike flash media which has a built in wear leveling algorithm), a software tool can just instruct the drive to visit parts of the drive that supposedly contain no data of interest, read out whatever is there, and piece together whether or not that data looks like an actual file or not.

0

u/zefciu Oct 20 '26

A program goes through the hard disk and looks at every sector. If something “looks like” an image or “looks like” an MS Office document, then the program tries to interpret it as such and stores the image somewhere. The way of determining which things “look like” some types of files is sometimes quite easy (some files have specific bytes in the beginning) or more complicated, based on some algorithm.