Unfortunately my large disk partition was corrupted (maybe because it was 100% full a few months, while quite a few processes wrote more 0 byte files on it). The mount fails with this error message:
root@server:/mnt$ mount /dev/md127 md/
mount: wrong fs type, bad option, bad superblock on /dev/md127, missing codepage or helper program
or other error In some cases useful info is found in
syslog - try dmesg | tail
or so.
Then I found this link suggesting running
e2fsck -y -f -v -C 0 /dev/sda3
But unfortunately it fails with the following error message:
Error storing directory block information (inode=14109880, block=0, num=471166008): Memory allocation failed
Solution
debugfs -w -R "clri <14109880>" /dev/vg/root
From: http://www.spinics.net/lists/linux-ext4/msg42703.html Then rerun the e2fsck from above. UPDATE I wrote this script to do the clearing – recheck -cycle automatically, since otherwise manually it might take weeks to complete:
#!/bin/bash
#TODO run first mkfs.ext3 -n $DEVICE to find out some backup -superblock
SUPERBLOCK=11239424
DEVICE=/dev/md127
function clear_inode() {
local INODE=$1
debugfs -w -R "clri <${INODE}>" $DEVICE
}
function check_inode() {
local INODE=`e2fsck -b $SUPERBLOCK -y -f -v -C 0 $DEVICE|grep "Error storing directory block information" |cut -d ' ' -f6 |cut -d '=' -f2 |cut -d ',' -f1`
#Case1: parse INODE from "Error storing directory block information (inode=14109880, block=0, num=471166008): Memory allocation failed"
echo "$INODE"
}
function is_int() {
if $(test -z $@) ; then
return 1 #false
fi
return $(test "$@" -eq "$@" > /dev/null 2>&1);
}
INODE=$(check_inode)
echo "Cheking $INODE"
OLDINODE=$INODE
#check whether INODE is integer
while $(is_int "${INODE}") ; do
echo "Clearing inode $INODE"
clear_inode $INODE
INODE=$(check_inode)
echo "New inode $INODE"
if [ "$INODE" -eq "$OLDINODE" ]; then
echo "ERROR Looping the same inode"
exit 2
fi
OLDINODE=$INODE
done
Update