0

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?

0 Answers0