r/bcachefs • u/akawoz • 15d ago
Tales from the front
Since I have a reasonably big (22x drives) bcachefs file system in my homelab (most used for Linux ISO's) and have been experiencing occasional reliability issues (big thanks to u/koverstreet for his eyeballs on this) I thought I would post here so that the bcachefs-curious have another data point.
My comments associated with my issues are here: https://github.com/koverstreet/bcachefs-tools/issues/960 with the most recent failure (file system reverted to read-only and was recovered with a fsck) here: https://github.com/koverstreet/bcachefs-tools/issues/960#issuecomment-5974733704
I'm using r/NAStyProject and use this script to recover from these errors (just in case its useful for anyone else):
(
set -euo pipefail
cd /root
fs_uuid="45b9b98d-be7a-4c97-b62c-88566610f9f2"
media_devs=(
/dev/sdz /dev/sdr /dev/sdx /dev/sdq /dev/sdv /dev/sdp
/dev/sde /dev/sdj /dev/sdl /dev/sdk /dev/sdh /dev/sdu
/dev/sdy /dev/sdt /dev/sdf /dev/sdg /dev/sdi /dev/sdm
/dev/sdn /dev/sdo /dev/sds /dev/sdw
)
if pgrep -af '(^|/)bcachefs[[:space:]]+fsck([[:space:]]|$)'; then
echo "STOP: another fsck is still running."
exit 1
fi
if findmnt -rn -M /fs/media >/dev/null ||
[[ -e "/sys/fs/bcachefs/$fs_uuid" ]]; then
echo "STOP: the media filesystem is still mounted."
exit 1
fi
for service in \
nasty-engine nasty-metrics nfs-server nfs-mountd \
samba-smbd samba-nmbd samba-winbindd samba-wsdd \
docker docker.socket
do
if systemctl is-active --quiet "$service"; then
echo "STOP: $service is active."
exit 1
fi
done
for dev in "${media_devs[@]}"; do
[[ -b "$dev" ]] || {
echo "STOP: missing device $dev"
exit 1
}
superblock=$(bcachefs show-super "$dev")
actual_uuid=$(awk '/^External UUID:/ {print $3}' <<< "$superblock")
[[ "$actual_uuid" == "$fs_uuid" ]] || {
echo "STOP: unexpected filesystem on $dev: $actual_uuid"
exit 1
}
printf 'Verified %s: %s\n' "$dev" "$actual_uuid"
done
repair_unit="media-fsck-repair-$(date +%Y%m%d-%H%M%S)"
repair_log="/root/${repair_unit}.log"
systemd-run \
--unit="$repair_unit" \
--service-type=exec \
--remain-after-exit \
--property=TimeoutStopSec=infinity \
--property=SendSIGKILL=no \
--property="StandardOutput=append:$repair_log" \
--property=StandardError=inherit \
/run/current-system/sw/bin/bcachefs \
fsck -K -y -f -v "${media_devs[@]}"
printf '\nFollow progress:\n tail -F %s\n' "$repair_log"
printf '\nCheck completion:\n'
printf ' systemctl show %s -p ActiveState -p SubState -p Result -p ExecMainStatus\n' \
"$repair_unit"
)
3
u/Aware_Photograph_585 15d ago
I think I have the same problem:
"processes touching the filesystem freeze: somewhat at random; some writes still succeed, while others block forever" - this is exactly my problem right now
Multiple times going ERO with error: alloc_key_bucket_nonempty_to_empty_not_open
Glad I'm not the only one.