That's where the wear-leveling on the SD card comes into things. The card's controller keeps track of how many times a particular page has been written to. Every now and then it swaps data from a block that has been used a lot to a block that hasn't been used much. So even if you have a file that never gets written to, it could move around the card. But because the blocks on the card get remapped internally it doesn't appear to have moved for the OS.
SD cards do not know anything about your partitions or your file systems or your files...if I only need a fraction of the space on a given card, is it better to leave some space unpartitioned, or should my partitions take up 100% of what's available? Maybe it makes no difference?
well it depends on the controller on the cardLomax wrote: ↑Tue Sep 10, 2019 9:49 am
I've read this sentence several times but still not sure if that's a "yes, leaving unpartitioned space helps with wear levelling" or "no, it makes no difference if your partitions use up all the space". Maybe I need more coffee...
pica200 wrote: ↑Tue Sep 10, 2019 10:21 amYou don't want to do more writes than necessary! Just leave the controller alone doing wear leveling for you. There is a rule of thumb to leave at least 10% of the capacity free to avoid slowdowns and early failure. If you need more space it's time for an upgrade.
pica200 wrote: ↑Tue Sep 10, 2019 10:21 amAnother thing you can do is add the "discard" mount option for the root partition. discard makes the filesystem driver in the kernel send block erase commands to the SD whenever you "delete" files. This is also known as TRIM for SSDs (the idea is the same but different names). This will give the controller infos about what space is used or not and it can increase speed aswell because it can pre-erase unused flash pages skipping a step when data is next written to it.
Code: Select all
PARTUUID=892be571-02 / ext4 defaults,noatime,discard 0 1