This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Check SD card errors
#1
Here you have script for checking SD card current errors:

Code:
function checkSDCardErrors()
    f = assert (io.popen('dmesg | grep mmcblk'))
    errorsCounter = 0
    for line in f:lines() do
     isThereSDError = line:match("mmcblk*..*: (.*error*..*)")
   if isThereSDError then errorsCounter = errorsCounter + 1 end
    end
    f:close()
 return errorsCounter
end

log(checkSDCardErrors())

It can be helpful in monitoring SD card and knowing about start of problems and that it must replacedWink
Reply
#2
(23.02.2018, 21:21)buuuudzik Wrote: Here you have script for checking SD card current errors:

Code:
function checkSDCardErrors()
    f = assert (io.popen('dmesg | grep mmcblk'))
    errorsCounter = 0
    for line in f:lines() do
     isThereSDError = line:match("mmcblk*..*: (.*error*..*)")
   if isThereSDError then errorsCounter = errorsCounter + 1 end
    end
    f:close()
 return errorsCounter
end

log(checkSDCardErrors())

It can be helpful in monitoring SD card and knowing about start of problems and that it must replacedWink

Recently I've been hit with a read-only SD card. Could this script be used in detecting a read-only SD card?
I became aware of this after a power cut and a reboot of the LM. It appeared that the card was already in read-only mode for quite a while. As a result of this I lost quite some trend log data...
Reply
#3
This was the purpose of this scriptWink But I know that there are different LM versions and also current versions has 2 storages so the best would be if admin would prepare such script or include such monitoring in firmware.
Done is better than perfect
Reply
#4
Hi
New LMs use NOR flash, industrial quality. Whole database, storage and trends are stored on to this flash. SD cards is now used only to store static files which are written once. SD was failing due to bigger amount of data was written now we hardly ever use it. Even when it will switch to read only LM will keep running as normal and everything will work just fine.
As we want to preserve the card as much as possible any script which will be checking it state will just make unnecessary additional write to it.
I don't think there is any need for such script now.
BR
------------------------------
Ctrl+F5
Reply
#5
But still there are a lot LMs with older version of hardware and there is such need because when you notice that your LM is read-only you can have a big lack of data which was not stored. Or you know that maybe better not to switch of or update such LM because after it will be without e.g. some scripts or some data.

So do I understand well that in the newest version there will be no SD errors in "System log"? If they will be still existing then there is no need to do some additional and unnescessary read/write because it would be enough to monitor if there are specific errors in the "System logs".
Done is better than perfect
Reply
#6
When I say new version I mean version which we ship since Feb 2018.
There is no need to monitor SD as all the data you care about are stored in NOR flash.
------------------------------
Ctrl+F5
Reply
#7
Yes, but what about older versions?
Done is better than perfect
Reply
#8
(24.09.2018, 08:29)buuuudzik Wrote: Yes, but what about older versions?

you have your scripts
------------------------------
Ctrl+F5
Reply
#9
(24.09.2018, 07:34)Daniel. Wrote: Hi
New LMs use NOR flash, industrial quality.  Whole database, storage and trends are stored on to this flash. SD cards is now used only to store static files which are written once. SD  was failing due to bigger amount of data was written now we hardly ever use it.  Even when it will switch to read only LM will keep running as normal and everything will work just fine.
As we want to preserve the card as much as possible any script which will be checking it state will just make unnecessary additional write to it.
I don't think there is any need for such script now.
BR

If I understand correctly, buuuudzik's script does not write or read from the SD card, so it should be OK to run it every now and then?

BR
Reply
#10
It was prepared for LM4 and it was working well so if you has also some LM with old hardware (before FEB 2018) than it should work. Maybe you still have some errors in System logs. If they're match to: "mmcblk*..*: (.*error" than it will work.
Done is better than perfect
Reply
#11
Does this script still work?

My SL has apparently been read only the last 10 days and when I get it swapped I would like to have something to check the state of the SD card at intervals.

I tried this script now, but it gives 0 errors..
Reply
#12
Look in System config -> Status -> System logs. If you didn' replace SD card then still you should have such errors like "mmcblk*..*: (.*error*..*)" but if you've changed SD card then probably you don't have such errors because they are on old SD card. But to be sure if this script is good for your LM version you have to compare above pattern with errors in you System logs, because this is how I've created this script.

When you have such error do the picture of logs, alerts, errors, System logs, because then it is helpful for others and also for helpers how to really solve the problem or create monitoring for it, and not only replace the SD card when it breaks in unknown circumstances and after unknown period of time and unknown manufacturer.
Done is better than perfect
Reply
#13
Will do buuuudzik
Reply
#14
There's no 100% working way to figure out whether SD card is working fine or switched to read-only without full system reset. Even then not all cards report that they are in read-only state.
Reply
#15
Ok, but with EMBS suggestions which manufacturer cards to use there is such possibility to achieve. Probably nobody who has LM doesn't buy the cheapest noname card, but more like Samsung, Sandisk or other to have a peace of mind for as much time as it is possible Smile
Done is better than perfect
Reply


Forum Jump: