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?

Gergely Lukacsy
  • 235
  • 2
  • 10
  • This fantasy seems to have nothing to do with the Pi. – Milliways Apr 18 '16 at 11:53
  • @Milliways I approve that the question was not too much Pi-related, but most linux boxes aren't using USB drives as their root partition, which is the case in my situation. So i tought it will be appropriate to ask this question on it's dedicated Stack community. ---- 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:47
  • "whenever a removable media becomes corrupted (or shows signs it's going to be), the system disables all writes on the disk " – Milliways Apr 19 '16 at 09:04
  • @Milliways I saw a few hints here and there on Stack Exchange, and I can remember there was an answer which linked a detailed article about the topic, but I can't find that particular answer. --- Otherways, here's one comment that mentions this behaviour: [Cannot format USB flash drive, everything claims it's write protected](http://superuser.com/a/819037/197567) – Gergely Lukacsy Apr 19 '16 at 09:54

0 Answers0