summaryrefslogtreecommitdiff
path: root/common/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'common/btrfs')
-rw-r--r--common/btrfs15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/btrfs b/common/btrfs
index 2fdefb18..670d9d1f 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -155,6 +155,11 @@ _check_btrfs_filesystem()
fi
rm -f $tmp.fsck
+ if [ $ok -eq 0 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
+ local flatdev="$(basename "$device")"
+ _btrfs_metadump "$device" "$seqres.$flatdev.check.md" >>$seqres.full
+ fi
+
if [ $ok -eq 0 ]; then
echo "*** mount output ***" >>$seqres.full
_mount >>$seqres.full
@@ -496,3 +501,13 @@ _require_btrfs_support_sectorsize()
grep -wq $sectorsize /sys/fs/btrfs/features/supported_sectorsizes || \
_notrun "sectorsize $sectorsize is not supported"
}
+
+_btrfs_metadump()
+{
+ local device="$1"
+ local dumpfile="$2"
+
+ test -n "$BTRFS_IMAGE_PROG" || _fail "btrfs-image not installed"
+ $BTRFS_IMAGE_PROG "$device" "$dumpfile"
+ [ -n "$DUMP_COMPRESSOR" ] && $DUMP_COMPRESSOR -f "$dumpfile" &> /dev/null
+}