Paolo Redaelli personal blog

Fried… again

So my aging Raspberry 3 fried yet another secure digital card. Luckily this time I was able to power it off when it was still readable but not writable so I haven’t lost data.

This time I won’t buy a cheap secure digital card, I’ll go for the Western Digital Purple, which are explicitly designed for constant writes and offers wear levelling.

But I also asked Brave to search for “Linux log to ram” and it’s AI suggested me azlux/log2ram:

Moving Linux system log files to RAM can significantly extend the lifespan of storage devices, particularly microSD cards used in systems like Raspberry Pi, by reducing write cycles to the physical disk. This is achieved using tools such as log2ram, which redirects the /var/log directory to a RAM-based tmpfs or zram device, storing logs in memory during system operation.

The log2ram utility works by creating a mount point in RAM for /var/log, so log entries are written directly to RAM instead of the physical disk. This setup helps prevent excessive wear on solid-state drives (SSDs) or microSD cards, which have limited write endurance. The tool synchronizes the contents of the RAM-based log directory back to the physical disk periodically—by default, once daily via a cron job—and also during system shutdown to ensure logs are preserved. If a power failure occurs, logs in RAM are lost, but the system will restore the previous day’s logs from the disk upon reboot

Quick reminder that SD cards with wear-leveling are now fairly common (i.e. WD Purple microSD)

https://www.westerndigital.com/products/embedded-removable-flash/surveillance-sd-microsd-cards

Vast majority of SD cards do not have wear-leveling, and might keep on writing to the same blocks over and over. In the end you wear out the card, and it becomes defective.

When using SD cards in servers/computers this might become a major issue, especially if you have software running that performs large amount of write operations and/or generates a lot of written data.

SD cards with wear-leveling used to be expensive, and small in size, and were usually reserved for specialized use (i.e. industrial applications). Today, you can get a 64GB SD card with WL for as low as 15 EUR.

Got the answer today (12 Feb 2020):

This is the statement I got back from Engineering regarding the wear leveling inquiry:

Our WD Purple MicroSD’s do both static and dynamic wear-leveling. Meaning all blocks across whole address space are considered for wear leveling regardless of if and how the blocks are used. This keeps the number of program erase cycles consistent on all blocks.

So yes, these cards have proper wear-leveling according to WD. Which is nice to have confirmed directly from the manufacturer.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.