Rather than RAM (default) or the root partition (/var/ -- far too small!), I used a high-capacity USB drive. Make sure this USB drive has enough free space before starting. You need at least X GB of space if your volume is 8TB like mine was. So, I'm guessing that this is why the fsck fails in the first place - at least, this is what my logs indicated when it said "Error storing directory block information (inode=90885846, block=0, num=6983948): Memory allocation failed"
Get root access to your NAS. I had already enabled root ssh before things went haywire because after the volume failed, FrontView would not load.
Attach a high-capacity storage device to the NAS via USB. Wait while the ReadyNAS loads the drive.
Download and compile the latest e2fsckprogs from the internet:
wget cd ./configure make
Configure e2fsck to use a cache:
mkdir /USB/USB_HDD/e2fsck #Configure yours accordingly echo "[scratch_files] directory = /USB/USB_HDD/e2fsck" > /etc/e2fsck.conf
Configure a new swap file (I picked 4GB but you might need more) -- This probably isn't necessary:
cd /USB/USB_HDD dd if=/dev/zero of=./swapfile1 bs=1024 count=4194304 mkswap ./swapfile1 swapon ./swapfile1
XXX Turn off journaling for performance. Make sure you have a UPS if you do this or some other protection from power loss.
tune2fs -O ^has_journal /dev/c/c #for performance
Check the filesystem. I had a superblock failure for my check, so if you do, then you may need to use
mke2fs -n /dev/c/c
to find superblock backup locations which you can try sequentially as an argument tofsck -b [block]
. The following command will likely fail with a 'Memory allocation failed' error after some time during the check so it needs to be re-run until all problems are fixed:/opt/e2fsckprogs/e2fsprogs-1.42.7/e2fsck/e2fsck -b 98304 -C 0 -y -v /dev/c/c
XXX Turn back on journaling for protection
tune2fs -O has_journal /dev/c/c #turn this back on