Objective: Get the last time the ext2/ext3/ext4 filesystem was checked on Linux using e2fsck
(a tool to check and repair a Linux ext2/ext3/ext4 file system).
The filesystem superblock holds a lot of parameters like block size, filesystem UUID, filesystem creation time, mount count, last checked time and many others. To determine when was the file system last checked or repaired using fsck
, we will need to look at the “Last checked” field.
1 2 |
# tune2fs -l /dev/sda1 | grep "Last checked" Last checked: Sat Nov 1 22:07:12 2014 |
The device /dev/sda1
is used as an example. Replace it with the device in question. The filesystem devices on your system will be defined under the /etc/fstab
file. For currently mounted file system devices, use the mount
command.
If you want to update the last checked time to the current time, use the following syntax with the now
keyword
1 |
# tune2fs -T now /dev/sda1 |
If you want to update the last checked time to a custom time, use the time specifier YYYYMMDD[HH[MM[SS]]]
. The below example sets the time to Dec 1 2014, 12 PM.
1 |
# tune2fs -T 201412011200 /dev/sda1 |