SD Card problem
I have a strange Problem with SD Cards. Almost every time, when there is a power outage, SD cart becomes completly corrupted (dead). After I need to replace the SD card, I load the new image on it and then I send the existing program to new card. Then it works normal until next power outage.
I am using UniPi Neuron L203 with Mervis OS image 2.2.0 installed.
Does anyone had the same problem? Does anyone have an Idea why this happens? Is the procedure after I changed the SD card correct? Or should i use commision mode?
Thank you very much in advance.
what SD cards are you using? The commonly available SD cards uses MLC technology which is good enough for phones/cameras, but not recommended for automation. We recommend using SLC cards such as https://www.unipi.technology/2gb-industrial-microsd-card-slc-p232?categoryId=33 which are much more reliable and handles the unexpected power outage much better.
I am using normal SD Cards, SandDisk and Kingston ....
I already ordered two pieces of the recommended cards.
Thank you for your advice.
I have the same problem. Today there was a power outage and one of my unipi1 SD cards got corrupted as well.
Sometimes it affects just one, but I already had to replace the SD cards at all 4 units at the same time. And it does not matter if it’s a power outage from the DNO or if I just trip my circuit breaker.
I use meanwell power supplies.
Any idea how this can be solved ?
Not sure it this might help you. But I have configured my OS to run "read-only". It helps for longer lasting SD cards and it will usually not corrupt upon power outage.
If you are interested, you might search for "Raspbian Read only".
See below my filesystems (just the main parts):
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=99612k,mode=755) /dev/mmcblk0p2 on / type ext4 (ro,noatime) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs on /var/cache type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /var/tmp type tmpfs (rw,nosuid,nodev,relatime) tmpfs on /var/log type tmpfs (rw,nosuid,nodev,relatime) /dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
And this is /etc/fstab:
PARTUUID=7965901e-01 /boot vfat ro,defaults 0 2 PARTUUID=7965901e-02 / ext4 ro,defaults,noatime 0 1 # a swapfile is not a swap partition, no line here # use dphys-swapfile swap[on|off] for that tmpfs /tmp tmpfs nodev,nosuid 0 0 tmpfs /var/log tmpfs nodev,nosuid 0 0 tmpfs /var/tmp tmpfs nodev,nosuid 0 0 tmpfs /var/cache tmpfs nodev,nosuid 0 0
Thanks for your reply. Now that I operate the RPis via Mervis OS would you have any idea how the read-only works there?
In the current version of Mervis OS 220.127.116.11, writes to the card already occur at least, according to the set interval for storing retain variables.
For a similar reason, the history is newly stored in RAM (data is lost after the power is disconnected or restarted), which does not matter in combination with the cloud-based Mervis DB.
If you disable writes to the internal storage (SD card), there are two possibilities of what can happen (depending on how you disable the writes):
- Mervis RT always unlocks the storage when writing retain variables, writes and locks the storage again for writing (basically the same behavior as now)
- Storage will be permanently locked and retain variables will not be writable. Likewise, it will not be possible to upload a new assembly (program) from Mervis IDE.
In general, I recommend purchasing an SLC card with a longer lifespan and resistance to random power outages, etc., for the operation of the controller.
You can read more about this issue in this article.