E2fsck aborts: memory allocation failed

ext3fsckmemory

I am trying to fix a 9 TB filesystem with e2fsck, however the scan always fails after about 10% or so with the following error:

Error storing directory block information: ... Memory allocation failed
e2fsck: aborted

The machine runs Ubuntu 10 (64 bit) and has 4 GB of memory. I have noticed that during checks the ram is getting nearly exhausted even though top only reports only 22% usage by the application and the memory can be reclaimed by a drop_caches. The swap space isn't touched.

In any case, I have approached this by giving e2fsck a scratch_files location which it fills with about 500M by the time it fails. Additionally, I have also set swapon -a, which also seem to prolong e2fsck's crashes.

How can I tune e2fsck so it doesn't crash? Is there any better way to repair my fs?

Best Answer

Sounds like you're running e2fsck from the local OS?

I don't know if it would make a difference or not, but what happens if you try from a LiveCD? Some have a lomem boot option, have you looked into that?

For lack of a better idea as of yet, is that an option?