diff mbox series

xfs_{admin,repair},man5: tell the user to mount with nouuid for snapshots

Message ID 20250307175501.GS2803749@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series xfs_{admin,repair},man5: tell the user to mount with nouuid for snapshots | expand

Commit Message

Darrick J. Wong March 7, 2025, 5:55 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Augment the messaging in xfs_admin and xfs_repair to advise the user to
replay a dirty log on a snapshotted filesystem by mounting with nouuid
if the origin filesystem is still mounted.  A user accidentally zapped
the log when trying to mount a backup snapshot because the instructions
we gave them weren't sufficient.

Reported-by: Kjetil Torgrim Homme <kjetilho@ifi.uio.no>
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 db/sb.c         |    9 +++++----
 man/man5/xfs.5  |    5 +++++
 repair/phase2.c |    9 +++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

Comments

Carlos Maiolino March 7, 2025, 6:07 p.m. UTC | #1
On Fri, Mar 07, 2025 at 09:55:01AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Augment the messaging in xfs_admin and xfs_repair to advise the user to
> replay a dirty log on a snapshotted filesystem by mounting with nouuid
> if the origin filesystem is still mounted.  A user accidentally zapped
> the log when trying to mount a backup snapshot because the instructions
> we gave them weren't sufficient.
> 
> Reported-by: Kjetil Torgrim Homme <kjetilho@ifi.uio.no>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


> ---
>  db/sb.c         |    9 +++++----
>  man/man5/xfs.5  |    5 +++++
>  repair/phase2.c |    9 +++++----
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/db/sb.c b/db/sb.c
> index aa8fce6712e571..52ac48d45d5ae6 100644
> --- a/db/sb.c
> +++ b/db/sb.c
> @@ -266,10 +266,11 @@ sb_logcheck(void)
>  		dbprintf(_(
>  "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
>  "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
> -"re-running %s.  If you are unable to mount the filesystem, then use\n"
> -"the xfs_repair -L option to destroy the log and attempt a repair.\n"
> -"Note that destroying the log may cause corruption -- please attempt a mount\n"
> -"of the filesystem before doing this.\n"), progname);
> +"re-running %s.  If the filesystem is a snapshot of a mounted filesystem,\n"
> +"you may need to give mount the nouuid option.  If you are unable to mount\n"
> +"the filesystem, then use the xfs_repair -L option to destroy the log and\n"
> +"attempt a repair.  Note that destroying the log may cause corruption --\n"
> +"please attempt a mount of the filesystem before doing this.\n"), progname);
>  		return 0;
>  	}
>  	/* Log is clean */
> diff --git a/man/man5/xfs.5 b/man/man5/xfs.5
> index 0c1edc53e227ce..f9c046d4721a14 100644
> --- a/man/man5/xfs.5
> +++ b/man/man5/xfs.5
> @@ -91,6 +91,11 @@ .SH DESCRIPTION
>  and
>  .BR xfsrestore (8)
>  are recommended for making copies of XFS filesystems.
> +To mount a snapshot of an already-mounted filesystem, you may need to supply
> +the
> +.B nouuid
> +option to
> +.BR mount " (8)."
>  .SH OPERATIONS
>  Some functionality specific to the XFS filesystem is accessible to
>  applications through the
> diff --git a/repair/phase2.c b/repair/phase2.c
> index 29a406f69ca3a1..9a9733749266e5 100644
> --- a/repair/phase2.c
> +++ b/repair/phase2.c
> @@ -72,10 +72,11 @@ zero_log(
>  				do_warn(_(
>  "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
>  "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
> -"re-running xfs_repair.  If you are unable to mount the filesystem, then use\n"
> -"the -L option to destroy the log and attempt a repair.\n"
> -"Note that destroying the log may cause corruption -- please attempt a mount\n"
> -"of the filesystem before doing this.\n"));
> +"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
> +"filesystem, you may need to give mount the nouuid option.If you are unable\n"
> +"to mount the filesystem, then use the -L option to destroy the log and\n"
> +"attempt a repair.  Note that destroying the log may cause corruption --\n"
> +"please attempt a mount of the filesystem before doing this.\n"));
>  				exit(2);
>  			}
>  		}
Bill O'Donnell March 7, 2025, 6:43 p.m. UTC | #2
On Fri, Mar 07, 2025 at 09:55:01AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Augment the messaging in xfs_admin and xfs_repair to advise the user to
> replay a dirty log on a snapshotted filesystem by mounting with nouuid
> if the origin filesystem is still mounted.  A user accidentally zapped
> the log when trying to mount a backup snapshot because the instructions
> we gave them weren't sufficient.
> 
> Reported-by: Kjetil Torgrim Homme <kjetilho@ifi.uio.no>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>

> ---
>  db/sb.c         |    9 +++++----
>  man/man5/xfs.5  |    5 +++++
>  repair/phase2.c |    9 +++++----
>  3 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/db/sb.c b/db/sb.c
> index aa8fce6712e571..52ac48d45d5ae6 100644
> --- a/db/sb.c
> +++ b/db/sb.c
> @@ -266,10 +266,11 @@ sb_logcheck(void)
>  		dbprintf(_(
>  "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
>  "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
> -"re-running %s.  If you are unable to mount the filesystem, then use\n"
> -"the xfs_repair -L option to destroy the log and attempt a repair.\n"
> -"Note that destroying the log may cause corruption -- please attempt a mount\n"
> -"of the filesystem before doing this.\n"), progname);
> +"re-running %s.  If the filesystem is a snapshot of a mounted filesystem,\n"
> +"you may need to give mount the nouuid option.  If you are unable to mount\n"
> +"the filesystem, then use the xfs_repair -L option to destroy the log and\n"
> +"attempt a repair.  Note that destroying the log may cause corruption --\n"
> +"please attempt a mount of the filesystem before doing this.\n"), progname);
>  		return 0;
>  	}
>  	/* Log is clean */
> diff --git a/man/man5/xfs.5 b/man/man5/xfs.5
> index 0c1edc53e227ce..f9c046d4721a14 100644
> --- a/man/man5/xfs.5
> +++ b/man/man5/xfs.5
> @@ -91,6 +91,11 @@ .SH DESCRIPTION
>  and
>  .BR xfsrestore (8)
>  are recommended for making copies of XFS filesystems.
> +To mount a snapshot of an already-mounted filesystem, you may need to supply
> +the
> +.B nouuid
> +option to
> +.BR mount " (8)."
>  .SH OPERATIONS
>  Some functionality specific to the XFS filesystem is accessible to
>  applications through the
> diff --git a/repair/phase2.c b/repair/phase2.c
> index 29a406f69ca3a1..9a9733749266e5 100644
> --- a/repair/phase2.c
> +++ b/repair/phase2.c
> @@ -72,10 +72,11 @@ zero_log(
>  				do_warn(_(
>  "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
>  "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
> -"re-running xfs_repair.  If you are unable to mount the filesystem, then use\n"
> -"the -L option to destroy the log and attempt a repair.\n"
> -"Note that destroying the log may cause corruption -- please attempt a mount\n"
> -"of the filesystem before doing this.\n"));
> +"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
> +"filesystem, you may need to give mount the nouuid option.If you are unable\n"
> +"to mount the filesystem, then use the -L option to destroy the log and\n"
> +"attempt a repair.  Note that destroying the log may cause corruption --\n"
> +"please attempt a mount of the filesystem before doing this.\n"));
>  				exit(2);
>  			}
>  		}
>
John Garry March 7, 2025, 8:37 p.m. UTC | #3
On 07/03/2025 17:55, Darrick J. Wong wrote:
> +"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
> +"filesystem, you may need to give mount the nouuid option.If you are unable\n"

mega nitpick: it looks like a space was missing before 'If'

> +"to mount the filesystem, then use the -L option to destroy the log and\n"
Andrey Albershteyn March 10, 2025, 12:24 p.m. UTC | #4
On 2025-03-07 20:37:48, John Garry wrote:
> On 07/03/2025 17:55, Darrick J. Wong wrote:
> > +"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
> > +"filesystem, you may need to give mount the nouuid option.If you are unable\n"
> 
> mega nitpick: it looks like a space was missing before 'If'

will fix it when applying

> 
> > +"to mount the filesystem, then use the -L option to destroy the log and\n"
>
Darrick J. Wong March 10, 2025, 5:26 p.m. UTC | #5
On Mon, Mar 10, 2025 at 01:24:26PM +0100, Andrey Albershteyn wrote:
> On 2025-03-07 20:37:48, John Garry wrote:
> > On 07/03/2025 17:55, Darrick J. Wong wrote:
> > > +"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
> > > +"filesystem, you may need to give mount the nouuid option.If you are unable\n"
> > 
> > mega nitpick: it looks like a space was missing before 'If'
> 
> will fix it when applying

Cool, thank you!

--D

> > 
> > > +"to mount the filesystem, then use the -L option to destroy the log and\n"
> > 
> 
> -- 
> - Andrey
> 
>
diff mbox series

Patch

diff --git a/db/sb.c b/db/sb.c
index aa8fce6712e571..52ac48d45d5ae6 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -266,10 +266,11 @@  sb_logcheck(void)
 		dbprintf(_(
 "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
 "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
-"re-running %s.  If you are unable to mount the filesystem, then use\n"
-"the xfs_repair -L option to destroy the log and attempt a repair.\n"
-"Note that destroying the log may cause corruption -- please attempt a mount\n"
-"of the filesystem before doing this.\n"), progname);
+"re-running %s.  If the filesystem is a snapshot of a mounted filesystem,\n"
+"you may need to give mount the nouuid option.  If you are unable to mount\n"
+"the filesystem, then use the xfs_repair -L option to destroy the log and\n"
+"attempt a repair.  Note that destroying the log may cause corruption --\n"
+"please attempt a mount of the filesystem before doing this.\n"), progname);
 		return 0;
 	}
 	/* Log is clean */
diff --git a/man/man5/xfs.5 b/man/man5/xfs.5
index 0c1edc53e227ce..f9c046d4721a14 100644
--- a/man/man5/xfs.5
+++ b/man/man5/xfs.5
@@ -91,6 +91,11 @@  .SH DESCRIPTION
 and
 .BR xfsrestore (8)
 are recommended for making copies of XFS filesystems.
+To mount a snapshot of an already-mounted filesystem, you may need to supply
+the
+.B nouuid
+option to
+.BR mount " (8)."
 .SH OPERATIONS
 Some functionality specific to the XFS filesystem is accessible to
 applications through the
diff --git a/repair/phase2.c b/repair/phase2.c
index 29a406f69ca3a1..9a9733749266e5 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -72,10 +72,11 @@  zero_log(
 				do_warn(_(
 "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"
 "be replayed.  Mount the filesystem to replay the log, and unmount it before\n"
-"re-running xfs_repair.  If you are unable to mount the filesystem, then use\n"
-"the -L option to destroy the log and attempt a repair.\n"
-"Note that destroying the log may cause corruption -- please attempt a mount\n"
-"of the filesystem before doing this.\n"));
+"re-running xfs_repair.  If the filesystem is a snapshot of a mounted\n"
+"filesystem, you may need to give mount the nouuid option.If you are unable\n"
+"to mount the filesystem, then use the -L option to destroy the log and\n"
+"attempt a repair.  Note that destroying the log may cause corruption --\n"
+"please attempt a mount of the filesystem before doing this.\n"));
 				exit(2);
 			}
 		}