Let's say I create a text file and write "Hello world!" to it. I stick with the default 4096 byte allocation size (assuming NTFS file system). I wonder what happens when I change (overwrite) the data in the file, to for example "Hello hello!"
I assume a physical hard drive simply overwrites the last 5 bytes in the allocated block, because it doesn't wear out with frequent writing. But what happens in case of an SSD? Does the system simply allocate another 4KB and leaves the previous one intact (that sounds horribly inefficient)? Because if the NAND memory chips can only survive so many writes they would corrupt rather quickly with frequent changes, right?
Or do file systems handle it in another, more efficient way? I'm coming from CS background so please excuse my ignorance :L