0

System:

  • Embedded board with Atmel SAM9x25
  • Debian Wheezy Kernel 3.11.6
  • 32GB Samsung SDHC card with ext4 root- partition (journal activated)

After system running two weeks or so superblock from rootfs (ext4) at block 0 got overwritten with "trash data". Here is a hex comparison between the an original superblock and the faulty:

hex comparision between faulty and good superblock starting at byte 1024

  • How is it possible, that even the magic number (and everything else) got overwritten?
  • Why could it ever be overwritten?
7
  • 1
    It's easily possible sinse "everything is a file"; for instance: dd if=/dev/random of=/dev/sda1 bs=1024 count=1 will overwrite the superblock on /dev/sda1 with random data. As to the second -- I have no idea. Obviously, such things don't happen under "normal" system activity. Isn't it possible that your SDHC card simply gone kaputt?
    – kostix
    Commented Dec 6, 2016 at 15:22
  • Say, your card could do wear leveling while having a bad internal block, and you were unfortunate to get that block mapped under the filesystem's superblock. Just an idea. If that's the case I'd advise to back up the whole card, swap it for another and run some diagnostics on the original (say, with badblocks in destructive mode).
    – kostix
    Commented Dec 6, 2016 at 15:25
  • 1.) we had this behaviour repeateadly and with multiple cards. Also I checked for badblocks which didnt show errors. 2.) I don´t know whether none/static/dynamic WL is used by SD-card controller (I am investigating) What would happen if the file system was full? Could that lead to bad mapping from wear leveling or so? Commented Dec 7, 2016 at 10:10
  • re (2): I doubt so: "filesystem full" is a "soft" event which has nothing to do with the underlying medium which simply has no idea what the data stored on it even means. But WL, to my knowledge, is free to dynamically "remap" data: that is, it can grab data off one of its internal blocks, physically write it on another and move that original one into a "free list". The idea is to prevent constant re-writing of only a small amount of physical blocks for a typical case of a filesystem which usually keeps quite a bit of "static" data which hardly ever changes.
    – kostix
    Commented Dec 7, 2016 at 13:33
  • Are all your cards of the same make/model?
    – kostix
    Commented Dec 7, 2016 at 13:34

0

You must log in to answer this question.

Browse other questions tagged .