]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
metadump: Add option to copy metadata blocks intact
authorEric Sandeen <sandeen@sandeen.net>
Wed, 29 Jul 2015 23:17:43 +0000 (09:17 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 29 Jul 2015 23:17:43 +0000 (09:17 +1000)
By default we zero out unused portions of metadata blocks.
This adds an option to keep blocks intact, to better investigate
corruptions.

Nothing in this patch reads it, but subsequent patches add
users of the option.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/metadump.c
db/xfs_metadump.sh
man/man8/xfs_metadump.8

index dd1d7ab9d640cd81745c574ea2363a13f13ca519..67d254567e540a17ed45f55bdb7a464fa74b13c7 100644 (file)
@@ -57,7 +57,7 @@ static void   metadump_help(void);
 
 static const cmdinfo_t metadump_cmd =
        { "metadump", NULL, metadump_f, 0, -1, 0,
-               N_("[-e] [-g] [-m max_extent] [-w] [-o] filename"),
+               N_("[-a] [-e] [-g] [-m max_extent] [-w] [-o] filename"),
                N_("dump metadata to a file"), metadump_help };
 
 static FILE            *outf;          /* metadump file */
@@ -75,6 +75,7 @@ static int            show_progress = 0;
 static int             stop_on_read_error = 0;
 static int             max_extent_size = DEFAULT_MAX_EXT_SIZE;
 static int             obfuscate = 1;
+static int             zero_stale_data = 1;
 static int             show_warnings = 0;
 static int             progress_since_warning = 0;
 
@@ -93,6 +94,7 @@ metadump_help(void)
 " for compressing and sending to an XFS maintainer for corruption analysis \n"
 " or xfs_repair failures.\n\n"
 " Options:\n"
+"   -a -- Copy full metadata blocks without zeroing unused space\n"
 "   -e -- Ignore read errors and keep going\n"
 "   -g -- Display dump progress\n"
 "   -m -- Specify max extent size in blocks to copy (default = %d blocks)\n"
@@ -2256,8 +2258,11 @@ metadump_f(
                return 0;
        }
 
-       while ((c = getopt(argc, argv, "egm:ow")) != EOF) {
+       while ((c = getopt(argc, argv, "aegm:ow")) != EOF) {
                switch (c) {
+                       case 'a':
+                               zero_stale_data = 0;
+                               break;
                        case 'e':
                                stop_on_read_error = 1;
                                break;
index a95d5a561605acd91d9f11b4057a18a99ac83d70..836d3aecfe141d14ed4faa4d6dc18502b435ba1f 100755 (executable)
@@ -5,11 +5,12 @@
 
 OPTS=" "
 DBOPTS=" "
-USAGE="Usage: xfs_metadump [-efFogwV] [-m max_extents] [-l logdev] source target"
+USAGE="Usage: xfs_metadump [-aefFogwV] [-m max_extents] [-l logdev] source target"
 
-while getopts "efgl:m:owFV" c
+while getopts "aefgl:m:owFV" c
 do
        case $c in
+       a)      OPTS=$OPTS"-a ";;
        e)      OPTS=$OPTS"-e ";;
        g)      OPTS=$OPTS"-g ";;
        m)      OPTS=$OPTS"-m "$OPTARG" ";;
index 077fff5f7cbecbc4d9e4f2c221f53a834fb1cc52..81a17a960b910c88f7c77c2ac5e9e1e4ca6815c9 100644 (file)
@@ -4,7 +4,7 @@ xfs_metadump \- copy XFS filesystem metadata to a file
 .SH SYNOPSIS
 .B xfs_metadump
 [
-.B \-efFgow
+.B \-aefFgow
 ] [
 .B \-m
 .I max_extents
@@ -74,6 +74,14 @@ tool.
 .PP
 .SH OPTIONS
 .TP
+.B \-a
+Copies entire metadata blocks.  Normally,
+.B xfs_metadump
+will zero any stale
+bytes interspersed with in-use metadata.  Use this option to copy full metadata
+blocks, to provide more debugging information for a corrupted filesystem.  Note
+that the extra data will be unobfuscated.
+.TP
 .B \-e
 Stops the dump on a read error. Normally, it will ignore read errors and copy
 all the metadata that is accessible.