Skip to content

Instantly share code, notes, and snippets.

@neurocis
Forked from hdevalence/corruptfile.sh
Last active December 17, 2022 08:23
Show Gist options
  • Save neurocis/e1a37bf06fd3702c5900c3eebc7445e7 to your computer and use it in GitHub Desktop.
Save neurocis/e1a37bf06fd3702c5900c3eebc7445e7 to your computer and use it in GitHub Desktop.
Btrfs corrupt file locator
#!/usr/bin/bash
echo "Looking for failed csum inodes...."
inodes=`dmesg | grep 'csum failed' | grep ino | sed 's/^.*ino \([0-9]*\) .*$/\1/g' | sort -u`
for f in $inodes; do echo -e " $f"; done
echo ""
echo "Finding files from inodes..."
corruptfiles=`for i in $inodes; do find /mnt/cache -inum $i 2>/dev/null; done`
for f in $corruptfiles; do echo -e " $f"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment