Home Storage

So you bought some disks, put them into your Linux box, put a filesystem on it, mounted and used it. Everything is fine, but out of the blue, the next you turn it on, it does not mount - what do you do? Run fsck on the disk and hope for the best - but what happens when you can’t and get this message instead?

[root@viglen ~]#  sudo e2fsck /dev/sdb
e2fsck 1.42.9 (28-Dec-2013)
/dev/sdb has unsupported feature(s): metadata_csum
e2fsck: Get a newer version of e2fsck!

Well, of course you yum update but that does not give you a new version - your system is upto date already! Well, looks like you have to find and download the latest version. I found the source and compiling it from source has never been so easy:

[root@viglen ~]# git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
Cloning into 'e2fsprogs'...
remote: Counting objects: 51366, done.
remote: Compressing objects: 100% (483/483), done.
remote: Total 51366 (delta 256), reused 0 (delta 0)
Receiving objects: 100% (51366/51366), 25.75 MiB | 912.00 KiB/s, done.
Resolving deltas: 100% (40981/40981), done.

[root@viglen ~]# cd e2fsprogs/
[root@viglen e2fsprogs]# ./configure 
tion file for e2fsprogs version 1.44.5
Release date is December, 2018
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes

--cut--

config.status: creating po/POTFILES
config.status: creating po/Makefile
[root@viglen e2fsprogs]# make
cd ./util ; make subst
make[1]: Entering directory `/var/tmp/e2fsprogs/util'
	CREATE dirpaths.h
	CC subst.c
	LD subst

--cut--

make[2]: Leaving directory `/var/tmp/e2fsprogs/doc'
make[1]: Leaving directory `/var/tmp/e2fsprogs'
[root@viglen e2fsprogs]# ./e2fsck/e2fsck /dev/sdb
e2fsck 1.44.5 (15-Dec-2018)
/dev/sdf: recovering journal
JBD2: Invalid checksum recovering block 686817391 in log
Journal checksum error found in /dev/sdb
/dev/sdf was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (288047076, counted=275639729).
Fix<y>? yes
Free inodes count wrong (183142730, counted=183142560).
Fix<y>? yes

/dev/sdf: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sdf: 5984/183148544 files (7.2% non-contiguous), 456926917/732566646 blocks
[root@viglen e2fsprogs]# mount /dev/sdb /mnt/target/

All done. One happy disk.