From 03091fc253963891c728cf362c0f9700294b6dfd Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 18 Nov 2013 16:02:05 +0000 Subject: [PATCH] xfsprogs: suggest "-d" option for repair of RO mount We can offer the suggestion of a "-d" repair, if we're in single-user mode with i.e. the root fs mounted readonly. This change suggests -d to repair any RO mounted fs. e2fsck allows this, and users are used to being able to do it in single-user mode. A separate patch will recommend a reboot after repair completes. Signed-off-by: Eric Sandeen Reviewed-by: Dave Chinner Signed-off-by: Rich Johnston --- repair/init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/repair/init.c b/repair/init.c index c3f380b30..d0940aaef 100644 --- a/repair/init.c +++ b/repair/init.c @@ -97,8 +97,17 @@ xfs_init(libxfs_init_t *args) else args->isreadonly = LIBXFS_EXCLUSIVELY; - if (!libxfs_init(args)) + if (!libxfs_init(args)) { + /* would -d be an option? */ + if (!no_modify && !dangerously) { + args->isreadonly = (LIBXFS_ISINACTIVE | + LIBXFS_DANGEROUSLY); + if (libxfs_init(args)) + fprintf(stderr, +_("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n")); + } do_error(_("couldn't initialize XFS library\n")); + } ts_create(); increase_rlimit(); -- 2.47.2