I am surprised by the large amount of data I'm writing to the root partition in a Raspberry Pi. My applications and system logs are not writing that much. I use the usual tricks to reduce it. What's going on ? The question is... how much are modifications of pointers in the file system burning out my SD card ?
Raspberry Pi's, due to their small size, boot from a micro-SD card, which is a flash drive. The root file system is also on that flash drive unless a second memory device is used for it. There are hundreds of posts about which file system to choose for a USB flash drive used with a Raspberry Pi. The limited life of the SD card is discussed in countless posts, usually of the form, make it larger, write less to it, and use noatime.
My question is different. Is the Raspberry Pi OS, since it presumably assumes the use of a flash drive for at least the boot file system and usually also the root partition, doing anything different to use a flash drive ? Since the binary bits in a block of flash memory are much more limited in their ability to be inverted than the bits in a magnetic disk, I cannot find any posts that discuss why the file system works AT ALL, * more than once *, from the point of view of the need to change pointers in the file system to point to a changed data file.
I'm trying to understand how a file system REALLY works on a Raspberry Pi on a flash drive to help find a way to prolong the life of the flash drive, regardless of all the other tricks mentioned above. ext4 is recommended for the root file system on a Raspberry Pi. How many files in the ext4 file system are modified when a data file is modified, however slightly ? Since flash memory has a finite number of program-erase cycles, and it's not possible to flip bits like in the old magnetic disk days (with flash, a single erased bit can be flipped but a single set bit cannot, so it's not possible to rewrite pointers, only to clobber them), I'm trying to see how many file system files and how many bytes in total get changed when a data file is updated. I must be missing something because it seems to me that every change in a data file ripples all the way up to the top level of the file system when flash memory is used, and that's a lot to change to change a little, thus wearing out the flash memory. And how is the top-most file system pointer changed ?
when a data file is updated
- or even when it is read