I know files are kept as chunks of blocks on disk or SD card. (SD card, being a block device, writes or reads in 512 Byte block. And file system itself manages with bigger size composed of those blocks like 4KByte maybe? I remember it is what is called allocation size and I know we can set this value when formatting the disk.)
When we edit a file, whether it's a plain text file or powerpoint file, and then save it, what happens in the file system?
My guess is the file system in the OS just allocates new blocks for the blocks from the point where the file had been changed and stores the parts after the changed location to the newly allocated blocks. Or if the application is written more smart, it will detect the changes and tries to minimize new block allocation (I mean accommodate the changes in as less number of blocks as possible and link them to the existing file blocks, like replacing blocks in the middle of a linked list). Of course this will have to waste some space in the newly assigned blocks but will keep the blocks in the later parts after the modification intact.
I would be glad if anyone can answer to my question or tell me my guess is correct or not.
ADD : from the comments, I figure it depends on OS and applications. and if I were a programmer who wrote the application(like power point or Word or any software) I would have overwrite to the allocation on the disk if it fits the change. I would appreciate it if someone just elaborate on this with some known examples.