Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a box running Ubuntu 11.10 with 512MB RAM and no swap. It has a 1TB USB HDD with ext3 filesystem attached. Sitting idle, it's only using about 60MB. When I run e2fsck, it runs out of memory, the OOM killer kicks in, and e2fsck dies.

Is there any trick to running e2fsck so that it uses less memory?

I ran:

sudo e2fsck -n /dev/sdb1

[Please don't tell me to enable swap or add memory -- I can't enable swap, and adding memory is the obvious long-term fix. I'd like a way to run fsck now.]

share|improve this question

2 Answers 2

I'm not sure which version of e2utils Ubuntu 11.10 has, however if it's fairly recent you can create /etc/e2fsck.conf file with something like this:

[scratch_files]
directory = /tmp/e2fs_scratch

Create that directory first, then run e2fsck. Using scratch file will greatly reduce memory use, however e2fsck will run very very slowly.

Of course if you need to check your root fs, you'll need to boot into another root, as the scratch directory will need to be writable.

share|improve this answer
    
Thanks, I'll try that. I figured there'd be a speed-memory tradeoff, so that should be ok. I'll kick it off tonight. –  bstpierre Nov 30 '11 at 19:17

I realize this is a really old topic, but since I had issues myself.. and the scratch file didn't work.. I figured I'd offer up how I got around it.

I manage a 12 tb file server and the way I got around this was to create a 12gb swap file on an external drive .. it was slower, but it managed to get through it.

# dd if=/dev/zero of=/mnt/external/swapfile1 bs=1024 count=12582912
# mkswap /mnt/external/swapfile1
# swapon /mnt/external/swapfile1

I named it swapfile1 so if it still wasn't enough I could create a second swapfile2 with the same steps..

To have the swapfile mount automtically you can add this line to /etc/fstab

/mnt/external/swapfile1 swap swap defaults 0 0

Of course the drive will need to be mounted before that line =)

share|improve this answer
    
It is not an answer, but a question. This site is very rigorous about this. I suggest to copy-paste this "answer" and ask this as a new question, until you can (it will be surely deleted). –  Peter Horvath May 9 at 14:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.