Skip to content

Instantly share code, notes, and snippets.

View jp-hoehmann's full-sized avatar

Jean-Pierre Höhmann jp-hoehmann

View GitHub Profile

Manually fixing bit flips in BTRFS

Somehow my BTRFS file system became corrupted by what appears to be a single bit flip in a metadata field. Rather than copying all the data and reformatting the file system, which would have required another disk at least as large as the original, I decided to try to fix this manually, which appears to have worked. I've documented the procedure I've used here, in case I need it again or someone else runs into a similar issue and finds it useful.

The first thing you should do is run btrfs check. For me this produced the following output:

Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p1
UUID: ec7afe1c-8478-450a-82fc-d17b32d8ca3d
@jp-hoehmann
jp-hoehmann / fetch-manpages.sh
Last active July 26, 2020 23:44
Fetch all manpages available in packages into the current directory
#!/usr/bin/env -S bash -euo pipefail
#
# Fetch all available manpages.
#
n=$(apt-cache pkgnames | wc -l)
i=0
for e in $(apt-cache pkgnames)
do