bob332 wrote: ↑
Sun Jul 25, 2021 1:22 am
Saying that a RAM drive will reduce writes to the SD Card, am I correct in thinking that a 8GB model will have less writes than a 2GB model or does the OS not work that way?
Possibly, it depends on your usage.
It also may reduce reads, which although they don't wear out the SD card, do help performance.
When the 8GB model was released Eben pointed out that all the app's on the OS distribution could fit in memory.
(every time you run a program, it and any data that it read or wrote, is retained in memory in case its used again. So if you run a program twice, the second time it will start much faster).
I also add this to the / (ext4) entry in fstab
PARTUUID=ca2ecb0f-02 / ext4 defaults,lazytime,noatime,commit=1000,errors=remount-ro 0 1
The commit=1000 reduces writes to the SD card and improves performance (at an increased risk of corruption if you have an unplanned power cut). I have used it for years on all my Pi's with no problems.
commit=1000 flushes the dirty blocks in the disk cache every 1000 seconds instead of the ultra-conservative default which is every 5 seconds.
As for RAM disks, tmpfs is actually "virtual memory", its not a normal RAM disk (which would be ramfs).
With tmpfs memory is only used for the actual files stored on it, unlike a RAM disk where the entire disk is allocated in memory.
Also if memory is short, tmps files will get paged out like any other memory.