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?