When you delete something from an SSD, do you accually delete it?

Kishan25

Distinguished
Apr 13, 2015
222
0
18,690
Ive read that when you delete something from a hard drive it just gets over written. Is this the same for an SSD?

Also why should i get a SSD for a primary drive if I know that SSDs are unreliable and dont last as long?
 
Solution

Nope. The speed of the HDD isn't affected by whether or not the location used by the file was previously used. Only the location of the file chunks matter. Chunks on the outer edge of the HDD platters are faster (because more of them pass under the read/write heads per rotation). And when the chunks are all in a line (sequential) it's faster because the HDD doesn't have to move the read/write heads and wait for the next chunk of data to spin under the heads.

Also, if you delete something, there's no guarantee the new download will go in the space formerly occupied by...
1) It is the same for an ssd.
2) It provides a massive boost in read and write speeds. If you put out enough money on a good quality ssd they can be just as reliable. It also depends on how heavily you use it. Your system will overall be much faster and more snappy with an ssd.
 

modernwar99

Reputable
Jul 9, 2014
1,166
0
5,960
Also whoever told you SSDs are more unreliable and short lasting than a HDD is plain wrong... A SSD has no mechanical parts to fail unlike a HDD and therefore has like 1/6 the annual failure rate of a average HDD. Unless you're writing an insane amount of data to it, its write capacity will easily last you 6+ years...
 

Kishan25

Distinguished
Apr 13, 2015
222
0
18,690


So even if I use softwares like trim it will still over write it?

Would the Samsung 850 evo 1 terabyte last me 5 years when all i do is gaming and web browsing?
 

Kishan25

Distinguished
Apr 13, 2015
222
0
18,690


Can you give me an example of an extreme amount of writes?
 


500gb+ per day.
 


850 evo would last no problem with that.
 

Others have answered your second question so I'll tackle this one.

When you delete something from a HDD, the computer could overwrite all the file data with zeroes. That would take a lot of time though, and isn't really necessary. Instead they just change the first byte of the file to a value that says, "this space is empty." The next time the computer is looking for space to write a file, it checks the first byte, sees it's marked as empty, and writes the file there. Writing this new file is what actually erases your old data. As you can imagine, if the disk is mostly empty, it can be a long time before the space used by the deleted file is actually overwritten. This is what makes it possible to undelete files.

SSDs differ from HDDs in two important ways.

1) The location of the file is not a fixed value. On a HDD, the file is (typically) written in 4k chunks. The end of each 4k chunk contains the location of the next 4k chunk. So if none of the deleted file's data has been overwritten by new files, and you can find that first 4k chunk, you can follow it to the next 4k chunk, read that and follow it to the next 4k chunk, etc. until you've recovered the entire file.

On a SSD, the location of the file is just an entry on a table. It's done this way because you can only write data to each memory cell of a SSD about a thousand times. If you bought a new SSD and immediately wrote a huge movie to it, then left that movie untouched for years while you continued to use the drive normally, the memory cells holding that movie would only experience one write while the other cells experienced dozens or hundreds of writes. This decreases the effective lifespan of the SSD.

To address this problem, the SSD manufacturers use something called wear leveling. The SSD detects that the cells holding the movie haven't been used as much. So it copies the movie to different cells, and frees up the used-once cells so they can be used more. In this way, all the memory cells in the SSD are used roughly the same amount (their wear is leveled), maximizing lifespan.

But if you moved the movie, how does the computer find it again? The SSD tricks the computer. It says the file is at location X. But then it has an internal table where virtual location X maps to physical memory cell y. When it runs the wear leveling and moves the movie to memory cell z, it just updates the table so it now says virtual location X maps to physical memory cell z. That way the computer can still request the data at location X, and the drive can deliver that data even though its not stored in the same physical memory cell anymore.

Now what happens when you try to undelete something from the SSD? If no wear leveling has occurred, then you can undelete just like with a HDD. But if wear leveling has occurred, at the point where the SSD would update the table so it says location X maps to memory cell z, it notices the file is marked as deleted. So there's no point updating the table since the file isn't supposed to exist anymore. The table doesn't get updated, and now the only way you can retrieve that 4k chunk of data is to read every single 4k chunk of memory space on the SSD and try to find one which seems to be the next 4k chunk in your file. This isn't impossible, but it's pretty close to it.

2) In a HDD, you can overwrite a 1 with a 0, or a 0 with a 1. You can't do that with a SSD. To write new data with a SSD, you have to first set the memory cell back to an erased state. That is, you have to go 1 -> erased -> 0, or 0 -> erased -> 1. (If you're an electrical engineer, it's basically an EEPROM.) When you deleted the file from a HDD, it just changed the first byte of the file. When you deleted the file on the SSD, it read the first 4k chunk, changed the first byte, wrote that new 4k of data to new memory cells, then updated its internal table so the first 4k of the file was pointing to the new memory cells.

So what happens to the original 4k of memory cells which held the file's original beginning? Remember how you have to go 1 -> erased -> 0 on a SSD? Well the erased -> 0 step is really fast. The 1 -> erased step is really slow. If you waited until the computer tried to write data to it to erase it, the write would go at like 200 kB/s. So the SSD keeps track of all these deleted 4k chunks, and in its spare time when you're not using the SSD it will go through the slow process of erasing them. In the old days (5 years ago), SSDs didn't know how filesystems worked, so the computer had to explicitly tell the SSD which 4k chunks were safe to erase. That's what TRIM was. Modern SSDs are programmed to understand common filesystems. So they're much better at erasing files which are actually deleted (not just the first 4k chunk) withing the computer telling it via TRIM. When the SSD erases the memory cells, the data originally on it is truly and completely gone.

So to answer your question, when you delete something from your SSD, it's initially just like a HDD - you don't actually delete it. But on a HDD as long as you don't write new data to the drive, the deleted file can still be recovered. On a SSD, if it does wear leveling or erasing of unused memory cells in the background, that can wipe out deleted data even though you haven't written new data to the drive.
 

Kishan25

Distinguished
Apr 13, 2015
222
0
18,690


So on a hard drive if i delete something and download something else in its place, wont that file be slower because its on a already used and overwritten part?
 

Nope. The speed of the HDD isn't affected by whether or not the location used by the file was previously used. Only the location of the file chunks matter. Chunks on the outer edge of the HDD platters are faster (because more of them pass under the read/write heads per rotation). And when the chunks are all in a line (sequential) it's faster because the HDD doesn't have to move the read/write heads and wait for the next chunk of data to spin under the heads.

Also, if you delete something, there's no guarantee the new download will go in the space formerly occupied by the file you deleted.
 
Solution