[Top] [All Lists]

[PATCH] xfs_metadump: Allow operation on frozen filesystems

To: xfs mailing list <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs_metadump: Allow operation on frozen filesystems
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Mon, 20 Jul 2009 14:07:15 -0500
User-agent: Thunderbird (X11/20090320)
The xfs_metadump manpage says that it works on a frozen filesystem,
but in reality it does not, and fails because the fs still looks
mounted & writable.

I don't think we have a way to test for frozen (!) so add a -F 
option which essentially overrides the xfs_db "-i" option with
a later "-r" which is more forgiving.

Document this, and a few other missing bits in the manpage.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

iff --git a/db/xfs_metadump.sh b/db/xfs_metadump.sh
index 28b04b8..ef51678 100755
--- a/db/xfs_metadump.sh
+++ b/db/xfs_metadump.sh
@@ -5,9 +5,9 @@
 OPTS=" "
-USAGE="Usage: xfs_metadump [-efogwV] [-m max_extents] [-l logdev] source 
+USAGE="Usage: xfs_metadump [-efogwFV] [-m max_extent] [-l logdev] source 
-while getopts "efgl:m:owV" c
+while getopts "efgl:m:owFV" c
        case $c in
        e)      OPTS=$OPTS"-e ";;
@@ -17,6 +17,7 @@ do
        w)      OPTS=$OPTS"-w ";;
        f)      DBOPTS=$DBOPTS" -f";;
        l)      DBOPTS=$DBOPTS" -l "$OPTARG" ";;
+       F)      DBOPTS=$DBOPTS" -r";;
        V)      xfs_db -p xfs_metadump -V
                exit $status
@@ -29,7 +30,7 @@ done
 set -- extra $@
 shift $OPTIND
 case $# in
-       2)      xfs_db$DBOPTS -F -i -p xfs_metadump -c "metadump$OPTS $2" $1
+       2)      xfs_db -F -i $DBOPTS -p xfs_metadump -c "metadump$OPTS $2" $1
        *)      echo $USAGE 1>&2
diff --git a/man/man8/xfs_metadump.8 b/man/man8/xfs_metadump.8
index f0ff1ae..1f74dd4 100644
--- a/man/man8/xfs_metadump.8
+++ b/man/man8/xfs_metadump.8
@@ -4,11 +4,15 @@ xfs_metadump \- copy XFS filesystem metadata to a file
 .B xfs_metadump
-.B \-efgow
+.B \-efgowFV
 ] [
 .B \-l
 .I logdev
+] [
+.B \-m
+.I max_extent
 .I source
 .I target
@@ -28,7 +32,10 @@ redirected to another program such as a compression 
 .B xfs_metadump
 should only be used to copy unmounted filesystems, read-only mounted
 filesystems, or frozen filesystems (see
-.BR xfs_freeze (8)).
+.BR xfs_freeze (8)
+and the
+.B \-F
+option below).
 Otherwise, the generated dump could be inconsistent or corrupt.
 .B xfs_metadump
@@ -94,12 +101,28 @@ For filesystems which use an external log, this specifies 
the device where the
 external log resides. The external log is not copied, only internal logs are
+.BI \-m " max_extent"
+Specify the maximum size of a metadata extent to process, in filesystem blocks.
+Anything larger than this will be considered corrupt metadata, and skipped.
+The default is 1000 blocks.
 .B \-o
 Disables obfuscation of file names and extended attributes.
 .B \-w
 Prints warnings of inconsistant metadata encountered to stderr. Bad metadata
 is still copied.
+.B \-F
+Allows a metadump of a filesystem frozen with
+.BR xfs_freeze (8).
+This overrides the normal tests that the fileystem is either unmounted
+or readonly; because there is no way to test for a frozen filesystem,
+this option must be manually specified.  Specifying this option on a 
+writable, non-frozen filesystem will likely result in a corrupted dump image.
+.B \-V
+Prints out the current version number and exits.
 .B xfs_metadump
 returns an exit code of 0 if all readable metadata is succesfully copied or

<Prev in Thread] Current Thread [Next in Thread>