5

Recently we encountered a problem (bad blocks) with an ext3 formatted compact flash card running an embedded Linux system. On startup, the root file system check was started, but it seemed to hang since it took much longer than usual. Later I plugged the card into another PC and I detected bad blocks. I wonder now if the initial root file system check would have found an repaired the blocks too, if I had waited long enough. To find it out I checked the tune2fs and e2fsck man pages but could not find the answers to my questions:

  1. Can I influence the checks/repairs that are performed with these automated root file system checks? If yes, how can I configure it?

  2. If it is not possible to configure: What exactly is checked or repaired, what are the default settings, what flags are used for the automated check?

3
  • Good question, but wouldn't unix.stackexchange.com be a better place to ask this?
    – jstarek
    Jun 15, 2012 at 10:55
  • 1
    I'm not sure about this, in a narrow sense the problem is not OS specific, it is more about the ext3 file system. But since ext3 is closely related to Linux, it would probably also be correct to ask the question there...
    – Chris
    Jun 15, 2012 at 12:01
  • I'd like to see the question left here. Many of us who are primarily Windows admins never go over to the unix site but we do run some Linux boxes and are interested in the answers. Jun 15, 2012 at 23:19

1 Answer 1

1

if the initial root file system check would have found an repaired the blocks

The OS will only trigger an automatic, full fsck in ext3 if the filesystem does not have journalling enabled and the system crashed or the remount limit is reached. It would have detected the bad blocks if you had attempted to write or read them - but this would not have triggered an automatic fsck - it would either remount the disk read-only or throw a kernel panic depending on how it has been configured.

Assuming that it's set up for journalling, then the tests done at mount only check what journal operations may have to be rolled forward.

I checked the tune2fs

Did you see what the -i, -C and -c flags do? (note that these only trigger an fsck at some future reboot - it is not possible to schedule a root fsck on a running system).

CF technology is getting rather long in the tooth and relatively expensive compared to other formats - begging the question how old is this card, and is it worth trying to save it. While it's quite possible to run an operating system of such devices, they're not really intended for this purpose - SATA connected nand flash drives are becoming commonplace but the reason they cost so much more than, say SD cards, is that include a lot of smarts for managing the storage and dealing with bad blocks.

Unfortunately there's no filesystem able to manage basic, write-limited storage devices connected via IDE/SCSI/USB (JFFS2 exploits direct acces to the underlying storage - i.e. devices plugged into the PCIe bus).

It's certainly a very ad idea to expect the CF device to behave like a normal disk - take a look at puppy - it does some very clever stuff with overlays to reduce the amount of writes to the disk, although it's possible to do a lot of tuning on all filesystems to reduce the frequency of writes - have a look at the recommendations for tuning Linux on Laptops to reduce I/O.

3
  • Thanks for your answer. What do you mean with "full fsck"? Where does the information come from? Yes I know the flags, it is not my question how the fsck is triggered, but what it actually does -- can it be configured to repair and not only check?
    – Chris
    Jun 27, 2012 at 14:32
  • 1) full fsck = checking every file and directory, 2) "if the filesystem does not have journalling enabled and the system crashed or the remount limit is reached" "The OS will...trigger an automatic, full fsck" 3) not for an automatic check
    – symcbean
    Jun 28, 2012 at 7:59
  • Thanks again. With question 2) I wanted to ask you how you know these things - is it your own experience, or do you cite a document? Thanks also for the general thoughts and concerns about CF, although this was not part of my question. Unfortunately I cannot influence it...
    – Chris
    Jun 28, 2012 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .