I have some raspberryPi2 model-B boards, using USB drives as their root filesystem. As it turned out, the USB chips I had chosen are prone to build up tremendous heat, and after 6-8 months, they started malfunctioning.
As far as I know, whenever a removable media becomes corrupted (or shows signs it's going to be), the memory controller disables all writes on the disk to prevent any further data corruption. This write-protection cannot be removed by conventional tools (needs manufacturer's special utilities which aren't public).
This happened to me a few times before, but I was able to migrate the whole system to the backup-USB (on the fly) when I discovered the problem in time. Sometimes however, I noticed the problem when it was too late, for eg. the system couldn't get up after reboot.
I need a proper method to check if the filesystem becomes corrupted/read-only (by hardware failure), so I can set up a mechanism to send notification about the problem.
I'm thinking about simply creating a test file in the temp area, and examining the command's return value, but I'm not sure it's entirely correct way to do that.
Something like this:
touch /tmp/testfile && { rm /temp/testfile; do stuff }
TL;DR; So basically, is there any failproof way to check the root filesystems' write permission/physical health, or this will be more than enough?
Out of couriosity, what do you like to tell me when using the term "fantasy"? Please pardon me, english is not my first language.
– Gergely Lukacsy Apr 19 '16 at 08:47Otherways, here's one comment that mentions this behaviour:
Cannot format USB flash drive, everything claims it's write protected
– Gergely Lukacsy Apr 19 '16 at 09:54