Tuesday 23 July 2013

For fsck's sake add swap...

If you're like most people undertaking an attempt to repair a really large volume (in this case 36TB), you run  fsck (or specifically e2fsck) without a second thought. Some days later (oh yes) you realise it's eating all of the RAM and making big inroads into swap. A quick check via your favourite search engine gets you the information that:

(i) it's going to eat more and when it runs out of RAM and swap fsck will crash and you'll have to start over, and;

(ii) you should have had more swap or used a scratch disk by creating an e2fsck conf file and configuring one as necessary.

Oh for the gift of foresight...

But an  option I ran into elsewhere is to simply add more swap on the fly. As this worked neatly and without any fuss, I thought I'd document it here for others with a similar issue.

As root or using sudo, do:

> fallocate -l 8g /mnt/fsck.swap

> mkswap /mnt/fsck.swap

> swapon /mnt/fsck.swap

where what you call it is up to you, where you put it is up to you (ideally on a volume not doing much else) and the size is dictated by the available space and set with the "-l 8g" line i.e. I made an 8GB swap file in the above example.

Now I've doubled swap there's a chance this fsck could finish. Sometime in the not too distant future :)

No comments: