I'd like to repair an ext2 file system on an external 16GB SD card drive.
When I issue the following command:
e2fsck -y /dev/xxx
my system runs out of memory (Fedora 17 x64 8GB RAM, 8GB Swap).
As suggested elsewhere, I've added:
[scratch_files] directory = /var/cache/e2fsck # (this directory exists and is writable to all)
Unfortunately, this fix does not seem to work. e2fsck does use the /var/cache/e2fsck directory, but still runs out of memory.
When I run the command interactively, it stops at the following prompt:
Inode 758 has an invalid extent (logical block 0, invalid physical block 140737488469058, len 1) Clear<y>? yes Inode 758, i_blocks is 8, should be 0. Fix<y>?
Answering yes or no to that prompt has the same result: the RAM used by e2fsck jumps suddenly to 8GB+ and my system freezes.
EDIT : Within VirtualBox
I tried fsck within VirtualBox, with a whopping 40Gb swap space. Fsck used all the 4GB RAM and about 30 GB swap, then it died with the following error message:
Error storing directory block information (inode=759, block=0, num=295645313): Memory allocation failed