How to Fix Longhorn Volume Mount Failure on CentOS 7.6 Using e2fsck
When a Longhorn volume fails to mount on a CentOS 7.6 node with the error ‘fsck found errors on device’, you can diagnose the issue via pod logs, download and install a newer e2fsck, then run fsck.ext4 with appropriate options to repair the filesystem and restore the volume.
View Pod Logs
kubectl describe po clickhouse-0 -n clickhouse
# ...
# Events:
# Type Reason Age From Message
# kubelet MountVolume.SetUp failed for volume "pvc-6561339a-6111-481c-a674-b4889c755299" :
# rpc error: code = Internal desc = 'fsck' found errors on device #/dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299
# but could not correct them: fsck from ...
# /dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299:
# UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.The log indicates that the node reports an fsck error and suggests running the command manually on the device.
Run fsck Manually
Execute the following command on the node where the pod is running:
fsck -cvf /dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299
# /dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299 has unsupported feature(s): metadata_csum
# e2fsck: Get a newer version of e2fsck!The output reveals that the bundled e2fsck lacks support for the filesystem's metadata checksum feature, prompting the need for a newer version.
Download a Newer e2fsck
wget https://distfiles.macports.org/e2fsprogs/e2fsprogs-1.45.6.tar.gz
tar -zxvf e2fsprogs-1.45.6.tar.gzInstall e2fsck
cd e2fsprogs-1.45.6
mkdir build && cd build
../configure
make && make installe2fsck Parameters Overview
device : the target partition, e.g., /dev/sda1 -a : automatic repair (same as -p)
-b : specify alternate superblock location
-B : set block size
-c : check for bad blocks
-C file : write progress to file -d : output debug information
-f : force checking
-F : flush device buffer cache before checking
-l bad_blocks_file : add bad blocks to list
-L bad_blocks_file : store bad‑block list (creates file if missing)
-n : open filesystem read‑only
-p : automatic repair (same as -a)
-v : verbose output
-V : display e2fsck version
-y : answer “yes” to all prompts automatically
Repair the Volume
fsck.ext4 -y /dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299
# /dev/longhorn/pvc-6561339a-6111-481c-a674-b4889c755299: ***** FILE SYSTEM WAS MODIFIED *****After the command completes, the filesystem is repaired and the Longhorn volume can be mounted successfully.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
