MicroSD lifespan and read/only longevity.
-
Concerning the endurance of microsd cards and their ability to make reads and write.
Mixed sources say that the number of write cycles (program erase cycles) for modern micro secure digital memory cards is 10,000 to 20,000 (maybe up to 10 times this). Writing 16kb blocks, on a 16gb microsd with wear-leveling, this might be writing a total of 1 terabyte and maybe 2 terabytes on a 32gb but my figures may be off. Considering the wear-leveling technology that distributes the data writes over the free blocks that have been written to less, a memory card with more free memory will last longer and keeping less than 4gb free on a microsd is non-recommended guidance.First to reduce the number of writes, and I have been doing this since I started working with raspberry pi. Disabling the swap space, the memory swap is not needed and that which as far as I know is and should not be used for raspberry pi. Again I do not know if the swap is ever being used, but I have disabled it always. The following three commands would disable swap, their inverse of course would re-enable.
sudo dphys-swapfile swapoff sudo dphys-swapfile uninstall sudo systemctl disable dphys-swapfile
Other than mount -noatime (no access time; rarely causes anything to fail) I haven't implemented any further write protection though I have looked into it. Some of the temporary files and logs I would consider that they should be written to the ram temporarily, but I haven't been confident in this over being written to the sdcard I just don't know. Of course something creating a lot of logs should be fixed.
As for the fixed number of writes to nand flash memory, I think I have understood that conversely the number of reads is in excess the life of the card 10 to 60 years that it can retain memory in the right conditions. If it were possible I would like to make the microsd read-only in my final write, and to make use of the ram for temporary files and logs and a usb memory card for saves and possibly temporary files and logs as well.
I'd like for any information and ideas anyone could share to achieve this. And remember to free up space on your microsd so that it will last longer. Cheers.
-
@Efriim said in MicroSD lifespan and read/only longevity.:
And remember to free up space on your microsd so that it will last longer. Cheers.
Why will it last longer ?
-
@mitu
There are a number of times that the memory blocks can be written to, dependent of the manufacture level I think the crystal diode simply has limited uses. This is supposedly at least 10,000 program erase cycles. The technology I referenced briefly called wear-leveling, I believe is a programmed part of the memory card module to reduce wear on the memory blocks by using alternate free memory blocks.Increasing the free space, will reduce the wear of these blocks on limited free space. Potentially increasing the lifespan by leaps and bounds, if ever you thought 120mb was enough free space.
-
@Efrii That's not quite right. The number of writes (thus causing wear leveling) is not proportional to the space used. If I store 120Gb of PS1 iso files on a 128 Gb disc - that I never re-write again - , this is not going to decrease the lifespan of my sd-card.
-
@mitu
and 8gb is enough for a modest amount of saves to be written not exceeding.1200mb would be enough for possibly 1 million 128kb wear-leveled writes on a class-10 micro sd device, if you add logs and configurations and anything else you can divide that number and if you use that space you can take it to a tenth. What else is there? Through the years, it is then a prudent consideration for the life of memory.
-
Hi Efriim,
check this out:
https://sudomod.com/forum/viewtopic.php?t=4258
This guy optimized his portable system (Kite's Circuit Sword), extended the SD lifespan and saved some power. There is a part about mounting temps and logs to RAM and even disabling them.
-
@SuperPitendo
Thank you. I never thought to mimic the overlay directories in the temp, I wouldn't have found it easy to do regardless. -
@Efriim said in MicroSD lifespan and read/only longevity.:
Disabling the swap space, the memory swap is not needed and that which as far as I know is and should not be used for raspberry pi. Again I do not know if the swap is ever being used, but I have disabled it always.
there's a function rpSwap that expands the swap when building many emulators/programs from source: https://github.com/RetroPie/RetroPie-Setup/blob/795aaf2ab8bcbb8eaf381adb0b1132acd12478c0/scriptmodules/helpers.sh#L316
i think disabling the swap file entirely may cause source rebuilds to fail, but that may or may not be important to you.
-
@dankcushions
That may have been why building libretro-mame (current) or 2016 would fail.
Though any other build from source would; besides the broken ones complete successfully.
I do have a working lr-mame2003-plus which took a long time.
Also enabling the swap space is again simply the inverse operation of the aforementioned.It appears that this helper creates its own swapfile as well as enables it for use, disabling the dphys-swapfile will not interrupt this.
-
Have used these instructions a few times and worked well.
https://medium.com/@andreas.schallwig/how-to-make-your-raspberry-pi-file-system-read-only-raspbian-stretch-80c0f7be7353
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.