summaryrefslogtreecommitdiff
path: root/misc/mke2fs.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2011-02-17 15:55:15 -0600
committerTheodore Ts'o <tytso@mit.edu>2011-02-20 20:45:12 -0500
commit3daf592646b668133079e2200c1e776085f2ffaf (patch)
treeece1a205bdd6ac37633934c9497c2900bef893b2 /misc/mke2fs.c
parentb6d274f7c67333e9d4b191b0d27a00be6a2d723f (diff)
downloade2fsprogs-3daf592646b668133079e2200c1e776085f2ffaf.tar.gz
e2fsprogs: turn off enforced fsck intervals by default
The forced fsck often comes at unexpected and inopportune moments, and even enterprise customers are often caught by surprise when this happens. Because a filesystem with an error condition will be marked as requiring fsck anyway, I submit that the time-based and mount-based checks are not particularly useful, and that administrators can schedule fscks on their own time, or tune2fs the enforced intervals if they so choose. This patch disables the intervals by default, and I've added a new mkfs.conf option to turn on the old behavior of random, unexpected, time-consuming fscks at boot time. ;) Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r--misc/mke2fs.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index b994e1e1..87d3c262 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2168,13 +2168,31 @@ int main (int argc, char *argv[])
uuid_generate((unsigned char *) fs->super->s_hash_seed);
/*
- * Add "jitter" to the superblock's check interval so that we
- * don't check all the filesystems at the same time. We use a
- * kludgy hack of using the UUID to derive a random jitter value.
+ * Periodic checks can be enabled/disabled via config file.
+ * Note we override the kernel include file's idea of what the default
+ * check interval (never) should be. It's a good idea to check at
+ * least *occasionally*, specially since servers will never rarely get
+ * to reboot, since Linux is so robust these days. :-)
+ *
+ * 180 days (six months) seems like a good value.
*/
- for (i = 0, val = 0 ; i < sizeof(fs->super->s_uuid); i++)
- val += fs->super->s_uuid[i];
- fs->super->s_max_mnt_count += val % EXT2_DFL_MAX_MNT_COUNT;
+#ifdef EXT2_DFL_CHECKINTERVAL
+#undef EXT2_DFL_CHECKINTERVAL
+#endif
+#define EXT2_DFL_CHECKINTERVAL (86400L * 180L)
+
+ if (get_bool_from_profile(fs_types, "enable_periodic_fsck", 0)) {
+ fs->super->s_checkinterval = EXT2_DFL_CHECKINTERVAL;
+ fs->super->s_max_mnt_count = EXT2_DFL_MAX_MNT_COUNT;
+ /*
+ * Add "jitter" to the superblock's check interval so that we
+ * don't check all the filesystems at the same time. We use a
+ * kludgy hack of using the UUID to derive a random jitter value
+ */
+ for (i = 0, val = 0 ; i < sizeof(fs->super->s_uuid); i++)
+ val += fs->super->s_uuid[i];
+ fs->super->s_max_mnt_count += val % EXT2_DFL_MAX_MNT_COUNT;
+ }
/*
* Override the creator OS, if applicable