2

This may be in part duplicate . However my installation is 15.04 64 bit desktop. And no one has answered on that question. It seems to be a basic query albeit very important one .

I did sudo tune2fs -l /dev/sda7 (I am assuming this is a safe command which can be executed while the disk is still mounted) Following are some of the values

Filesystem created:       Fri Sep 18 05:48:19 2015
Last mount time:          Thu Oct  1 21:01:39 2015
Last write time:          Thu Oct  1 21:01:39 2015
Mount count:              12
Maximum mount count:      -1
Last checked:             Sat Sep 19 03:27:50 2015
Check interval:           0 (<none>)
Lifetime writes:          1037 GB

I also checked across other laptops. Everywhere I found that Maximum mount count and check interval is -1 and 0, thereby disabling any file checking.

Quoting from man tune2fs " You should strongly consider the consequences of disabling mount-count-dependent checking entirely. Bad disk drives, cables, memory, and kernel bugs could all corrupt a filesystem without marking the filesystem dirty or in error. If you are using journaling on your filesystem, your filesystem will never be marked dirty, so it will not normally be checked. A filesystem error detected by the ker‐ nel will still force an fsck on the next reboot, but it may already be too late to prevent data loss at that point."

Am I missing some thing here? Some thing this important would it not be automatically set during the installation.

Please guide as to whether I should panic and force fsck on all my machines/external disks (some of them are couple of years old.

And also should I explicitly set these parameters.

Amit
  • 392
  • 2
  • 14

1 Answers1

3

You shouldn't panic just yet, instead, let's have a look at https://help.ubuntu.com/community/FilesystemTroubleshooting:

"There are 4 ways the fsck tool usually gets run (listed in order of frequency of occurrence):

  1. it runs automatically during computer bootup every X days or Y mounts (whichever comes first). This is determined during the creation of the filesystem and can later be adjusted using tune2fs.
  2. it runs automatically if a filesystem has not been cleanly unmounted (e.g.: powercut)
  3. user runs it against an unmounted filesystem
  4. user makes it run at next bootup "

Note the number 2 in particular:

"If a filesystem has not been cleanly unmounted, the system detects a dirty bit on the filesystem during the next bootup and starts a check. It is strongly recommended that one lets it finish. It is almost certain there are errors on the filesystem that fsck will detect and attempt to fix. Nevertheless, one can still interrupt the check and let the system boot up on a possibly corrupted filesystem."

In the end, it is the matter of convinience vs extra-caution - always a fine balance.

PS: It's a good idea not to rely on fsck alone, but also keep regular backups of all data you don't want to lose.

mikewhatever
  • 32,638
  • Thanks mikewhatever, but what are the defaults. Is it some thing which a user has to configure themselves. I was under impression that option 1) would be part of default setup. – Amit Oct 03 '15 at 19:47
  • Not sure why you are under such an impression. It has not been the default for several years, though I am not sure exactly when it got changed (seems to be 2008). People used to complain a lot about disk checks at boot, and so, the it got changed. Obviously, users may configure things, should they wish to. – mikewhatever Oct 03 '15 at 20:37
  • The impression was more from google search- https://linhost.info/2010/05/tune2fs-quick-tips/ . But thanks for confirming, now I will setup my parameters. I tend to side extra-caution than convenience. – Amit Oct 03 '15 at 20:52