aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-03-23 18:57:02 -0700
committerTheodore Ts'o <tytso@mit.edu>2018-08-05 14:43:12 -0400
commit2b17b98e41180d17b4916a9e13a2a891906653a7 (patch)
tree29a6d83b270ffd6a1b7fcf415c0f09df067b0678 /misc
parentf4f701db3217ef97f46a8df65bad1d0978c8b031 (diff)
downloadandroid_external_e2fsprogs-2b17b98e41180d17b4916a9e13a2a891906653a7.tar.gz
android_external_e2fsprogs-2b17b98e41180d17b4916a9e13a2a891906653a7.tar.bz2
android_external_e2fsprogs-2b17b98e41180d17b4916a9e13a2a891906653a7.zip
tune2fs: allow setting the filesystem error bit
Allow the administrator to mark the filesystem's error bit to force a fsck at the next mount. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Andreas Dilger <adilger@dilger.ca> Reviewed-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/tune2fs.8.in4
-rw-r--r--misc/tune2fs.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index 740d1661..f1def2bf 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -238,6 +238,10 @@ program.
This superblock setting is only honored in 2.6.35+ kernels;
and not at all by the ext2 and ext3 file system drivers.
.TP
+.B force_fsck
+Set a flag in the filesystem superblock indicating that errors have been found.
+This will force fsck to run at the next mount.
+.TP
.B test_fs
Set a flag in the filesystem superblock indicating that it may be
mounted using experimental kernel code, such as the ext4dev filesystem.
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index f1ddfe42..4b673bc2 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -2118,6 +2118,10 @@ static int parse_extended_opts(ext2_filsys fs, const char *opts)
intv);
fs->super->s_mmp_update_interval = intv;
ext2fs_mark_super_dirty(fs);
+ } else if (!strcmp(token, "force_fsck")) {
+ fs->super->s_state |= EXT2_ERROR_FS;
+ printf(_("Setting filesystem error flag to force fsck.\n"));
+ ext2fs_mark_super_dirty(fs);
} else if (!strcmp(token, "test_fs")) {
fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS;
printf("Setting test filesystem flag\n");
@@ -2200,6 +2204,7 @@ static int parse_extended_opts(ext2_filsys fs, const char *opts)
"\tmmp_update_interval=<mmp update interval in seconds>\n"
"\tstride=<RAID per-disk chunk size in blocks>\n"
"\tstripe_width=<RAID stride*data disks in blocks>\n"
+ "\tforce_fsck\n"
"\ttest_fs\n"
"\t^test_fs\n"));
free(buf);