e2fsprogs/misc/e2mmpstatus.8.in
Shuichi Ihara 32b8802aa5 misc: add e2mmpstatus utility via dumpe2fs
e2mmpstatus is a Multi-Mount Protection (MMP) helper utility to read
an MMP block to see if it is being updated.  It can also output the
latest update time, nodename, and device from the MMP block.

This is useful for HA and other maintenance scripts to determine if
the filesystem is in use on another node, and which node it is.

Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>

Moved e2mmpstatus checking/dumping code to be part of dumpe2fs rather
than a standalone program, using the "-m" option to check MMP status,
and "-i" to dump info.  If dumpe2fs is called as "e2mmpstatus" (and
also "mmpstatus" for compatibility reasons), assume "-m" is specified.

Re-use the existing MMP block handing routines (with some changes) to
check and dump the MMP block, rather than adding duplicate versions.

Modify dumpe2fs to exit with a non-zero error code if there is an
error while reading the filesystem metadata or MMP block, or if
"-m" is used with the "mmp" feature and is in use by another node.

Add a configure check for gethostname() rather than depending on
_BSD_SOURCE or _XOPEN_SOURCE to be set.

Update the f_mmp, m_mmp, m_mmp_bad_csum, and m_mmp_bad_magic tests
to use e2mmpstatus to check and dump the MMP state before and after
e2fsck is run to verify that the tool is working correctly.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-22 18:22:37 -04:00

60 lines
1.9 KiB
Groff

.\" -*- nroff -*-
.\" This file may be copied under the terms of the GNU Public License.
.\"
.TH E2MMPSTATUS 8 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
e2mmpstatus \- Check MMP status of an ext4 filesystem
.SH SYNOPSIS
.BR e2mmpstatus " [" \-i ]
.RI < filesystem >
.SH OPTIONS
.TP
.B \-i
prints out the MMP information rather than check it.
.SH DESCRIPTION
.B e2mmpstatus
is used to check Multiple-Mount Protection (MMP) status of an ext4
filesystem with the
.B mmp
feature enabled. The specified
.I filesystem
can be a device name (e.g.
.IR /dev/hdc1 ", " /dev/sdb2 ),
or an ext4 filesystem label or UUID, for example
.B UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd
or
.BR LABEL=root .
By default, the
.B e2mmpstatus
program checks whether it is safe to mount the filesystem without taking
the risk of mounting it more than once.
.PP
MMP (multiple-mount protection) is a feature that adds protection against
the filesystem being modified simultaneously by more than one node.
It is NOT safe to mount a filesystem when one of the following conditions
is true:
.br
\ 1. e2fsck is running on the filesystem.
.br
\ 2. the filesystem is in use by another node.
.br
\ 3. The MMP block is corrupted or cannot be read for some reason.
.br
The
.B e2mmpstatus
program might wait for some time to see whether the MMP block is being
updated by any node during this period. The time taken depends on how
frequently the MMP block is being written by the other node.
.SH EXIT CODE
The exit code returned by
.B e2mmpstatus
is 0 when it is safe to mount the filesystem, 1 when the MMP block shows
the filesystem is in use on another node and it is NOT safe to mount
the filesystem, and 2 if some other failure occurred that prevents the
check from properly detecting the current MMP status.
.SH SEE ALSO
.BR dumpe2fs (8),
.BR e2fsck (8),
.BR fstab (5),
.BR fsck (8),