From: Darrick J. Wong <djwong@xxxxxxxxxx> If xfs_metadump supports the -x switch to capture the contents of external log devices and there is an external log device, add the option to the command line to enable preservation. Similarly, if xfs_mdrestore supports the -l switch and there's an external scratch log, pass the option so that we can restore log contents. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- common/xfs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/xfs b/common/xfs index 29130fabbc..36e02413db 100644 --- a/common/xfs +++ b/common/xfs @@ -667,9 +667,20 @@ _xfs_metadump() { shift; shift; shift; shift local options="$@" test -z "$options" && options="-a -o" + local metadump_has_dash_x + + # Does metadump support capturing from external devices? + $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-[a-zA-Z]*[wW]x' && \ + metadump_has_dash_x=1 if [ "$logdev" != "none" ]; then options="$options -l $logdev" + + # Tell metadump to capture the log device + if [ -n "$metadump_has_dash_x" ]; then + options="$options -x" + unset metadump_has_dash_x + fi fi $XFS_METADUMP_PROG $options "$device" "$metadump" @@ -696,6 +707,13 @@ _xfs_mdrestore() { fi test -r "$metadump" || return 1 + # Does mdrestore support restoring to external log devices? If so, + # restore to it, and do not wipe it afterwards. + if [ "$logdev" != "none" ] && $XFS_MDRESTORE_PROG --help 2>&1 | grep -q -- '-l logdev'; then + options="$options -l $logdev" + logdev="none" + fi + $XFS_MDRESTORE_PROG $options "${metadump}" "${device}" res=$? test $res -ne 0 && return $res