0

I use to order fsck by doing:

# touch /forcefsck

On Ubuntu Linux v14 I have found this method to check if, after rebooting, it was performed:

luis@Terminus:~$ sudo dumpe2fs /dev/sda7 | grep "mount" -i
dumpe2fs 1.42.9 (4-Feb-2014)
Last mounted on:          /
Default mount options:    user_xattr acl
Last mount time:          Sun Feb 28 23:24:18 2016
Mount count:              1
Maximum mount count:      -1

The trick is in the Mount count data: it is supposed to tell the number of times the partition has been mounted after the last check. So a number of 1 after rebooting means it was just checked right now.

But on Kali Linux v2.0 it seems not to be working all right. This is the result after the same touch /forcefsck command:

luis@Midnighter:~$ sudo dumpe2fs /dev/sdb8 | grep "mount" -i
dumpe2fs 1.42.12 (29-Aug-2014)
Last mounted on:          /
Default mount options:    user_xattr acl
Last mount time:          Sun Feb 28 21:22:49 2016
Mount count:              82
Maximum mount count:      -1

How could I confirm fsck was performed?

1

There's a direct way of telling when fsck was last run on the filesystem:

tune2fs -l /dev/sdb8 | grep '^Last checked:'

(or dumpe2fs instead of tune2fs -l.)

On Debian, the presence of /forcefsck causes the boot scripts to run fsck -f instead of fsck, which forces a filesystem check (normally fsck just says that the filesystem is clean and exits immediately). I don't know if Kali Linux has changed the relevant script (/etc/init.d/checkroot.sh on a SysVinit system).

  • Indeed, at Kali the forcefsck trick does not work. I have finally succeded with this method based on mounting the root partition as read-only, reboot, fsck, reboot and remount as read-write again: bitsofmymind.com/2014/03/14/… . Tested working via SSH. – Sopalajo de Arrierez Feb 29 '16 at 1:40
  • It is hard to believe that there is no easy/quick way to check your root file system on Linux. Even Windows can do it via chkdsk /f. – Sopalajo de Arrierez Feb 29 '16 at 1:43
  • @SopalajodeArrierez why do you think you should want to check the root file system? – roaima Feb 29 '16 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.