logo elektroda
logo elektroda
X
logo elektroda

Raspberry Pi SD Card Wear: Minimizing Consumption for 24/7 Operation & Reliability

henryxxl 7047 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16574493
    henryxxl
    Level 26  
    Hello.
    I have a question, once I came across the problem of fast consumption of sd cards on which the system is. Due to the fact that RPi did not play for a long time and I am currently not with knowledge. Can you write back how it is with this problem right now? I want to create a device that is supposed to work 24/7 and I care about the lowest failure rate.
    Regards/
  • ADVERTISEMENT
  • #2 16574673
    michcior
    Level 30  
    Two solutions:
    1) Read-only card, a few small configurations and it will be unbreakable.
    2) squashfs, I didn't try it on RPI but on PC. A compressed file system unpacked into RAM. Well, the disadvantage is that the entire FS must fit in RAM and there is not much on RPI.
  • ADVERTISEMENT
  • #3 16574688
    piterek-23
    Level 33  
    Or Raspberry 3, a system on a solid USB stick and no SD card at all
  • #4 16574912
    henryxxl
    Level 26  
    I'm talking about Rpi 0 and the card is micro sd there so I will not read-only unless there is another way ;)
  • ADVERTISEMENT
  • #5 16574938
    michcior
    Level 30  
    It's not about the jumper, it's just about mounting the file system!
    1) in / etc / fstab we set the root filesystem to be mounted like "ro" instead of "rw":
    Code: Bash
    Log in, to see the code

    2) you need a small ramdisk in the / tmp directory in / etc / fstab:
    Code: Bash
    Log in, to see the code

    3) It is good to disable all logs, or at least do / var / log some ramdisk logs will block themselves (a bit shortcuts but it works):
    Code: Bash
    Log in, to see the code

    4) no swaps
    5) if you use X, before starting Xorg:
    Code: Bash
    Log in, to see the code


    Temporarily unblock / you can:
    # mount / -o remount, rw
  • ADVERTISEMENT
  • #6 16574993
    tronics
    Level 38  
    piterek-23 wrote:
    Or Raspberry 3, a system on a solid USB stick and no SD card at all

    Eh, good SD and good flash drives have wear leveling in some primitive (in relation to SSD) form, and what is damaged or flash is all equally sensitive. So what is the argument to use a good flash drive in place of a good SD? It is better to buy a USB-> SATA adapter and connect the cheapest SSD (it will come out a little more expensive than a super duper pendrive, but it will be faster and more durable).

    As for all read only agonizing - you have to remember that it makes sense as long as we have a fully configured system for work and absolutely NOTHING is going to change, install, upgrade, etc. This is basically a wrong approach if a server with data archiving (e.g. Domoticz) is to be on Pi. Ie. it can be done (with archiving to another medium, e.g. network) but it is a lot of gymnastics.
  • #7 16575008
    piterek-23
    Level 33  
    tronics wrote:
    piterek-23 wrote:
    Or Raspberry 3, a system on a solid USB stick and no SD card at all

    Eh, good SD and good flash drives have wear leveling in some primitive (in relation to SSD) form, and what is damaged or flash is all equally sensitive. So what is the argument to use a good flash drive in place of a good SD?

    I have the impression (this is not supported by any laboratory tests) that an ordinary USB stick is "more durable" than an SD card.
    You can buy a flash drive with SLC memory-I know, I know SD you can also buy: MLC, pSLC, SLC ... but USB is better to "hold" raspberries than this poor SD slot. I'm writing about SLC because after all, the number of write / erase cycles is limited. After exceeding it, reliable and error-free data reading and reading is no longer guaranteed. The service life of the SLC type memory is 100,000 write / delete cycles, and the MLC type memory is 10,000, and ordinary SD cards (the ones we use most often) are 300-500 such operations.
  • #8 16575038
    tronics
    Level 38  
    A colleague meant SLC (single level cell). SLC is very expensive so let's face it. A capacious cheap SSD on MLC will be a better solution than a durable and small SLC flash drive. But this is already running away from the main topic of discussion. The author did not write what he needed for it, RPi and whether read-only filesystem will apply.
  • #9 16575045
    piterek-23
    Level 33  
    tronics wrote:
    A colleague meant SLC (single level cell)

    That's right, it was about SLC ... I am already correcting because I wrote once and once ;)
    You are right, let's finish offtop because this topic was not about.
  • #10 16575125
    michcior
    Level 30  
    1) There are SSDs where SLC is as cache and main memory is MLC.
    2) MLC are also 2.3 levels, surely and more bits will be extracted from the cell. The more bits the worse, so the term MLC alone is not enough.
    3) I quickly searched if there is such a wonder like RAM on a USB key but nobody came up with such a thing. And that would be interesting, the key from RAM and flash, after startup, copies the file system from flash to RAM.
  • #11 16575130
    henryxxl
    Level 26  
    I want to make a device that uses a gsm modem reads and sends sms and saves statistics in a file. Plus a modification panel (like router configuration).
  • #12 16575145
    michcior
    Level 30  
    Oh, then you can do the partition for configuration data / statistics and mount it as RW, and rootfs as RO.
  • #13 16575339
    henryxxl
    Level 26  
    After installing the system, how do I make all the changes, update will then be able to set the system partition as ro?
    How is the card's lifetime only?
  • #14 16575351
    michcior
    Level 30  
    Exactly. If you need to change something, you unlock it as I said. Memory cells niches write, not read. Therefore, turning off recording significantly improves their service life. In any case, its limitation also helps. The system saves a lot of things just like that, and these are logs, and there are some statuses and something like that, any unnecessary recording consumes the card. See, the mount options are "noatime", this prevents the date of last access to the file from being updated, every file the system touches has this status saved. There is also "noadirtime" and concerns access to directories.

Topic summary

The discussion centers on minimizing SD card wear in Raspberry Pi (RPi) devices intended for 24/7 operation. Key strategies include using a read-only filesystem, configuring the root filesystem to mount as read-only, and utilizing RAM-based filesystems for temporary data. Alternatives to SD cards, such as solid-state drives (SSDs) and USB flash drives, are recommended for better durability, particularly those with SLC (Single Level Cell) memory, which offer higher write cycle limits compared to standard SD cards. Participants also suggest partitioning for configuration data to allow read-write access while keeping the root filesystem read-only. Proper configuration can significantly extend the lifespan of the storage medium.
Summary generated by the language model.
ADVERTISEMENT