Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
You could use tune2fs to set the current mount count to a value that would cause the filesytem to be checked.
Code:
# tune2fs -l /dev/sda2 | grep -i 'mount count'
Mount count: 4
Maximum mount count: -1
# ### Looks like I currently have that check disabled. I'll have to set both the current count and the maximum count.
# tune2fs -c 25 -C 999 /dev/sda2
tune2fs 1.41.9 (22-Aug-2009)
Setting maximal mount count to 25
Setting current mount count to 999
# tune2fs -l /dev/sda2 | grep -i 'mount count'
Mount count: 999
Maximum mount count: 25
#
You could use tune2fs to set the current mount count to a value that would cause the filesytem to be checked.
Code:
# tune2fs -l /dev/sda2 | grep -i 'mount count'
Mount count: 4
Maximum mount count: -1
# ### Looks like I currently have that check disabled. I'll have to set both the current count and the maximum count.
# tune2fs -c 25 -C 999 /dev/sda2
tune2fs 1.41.9 (22-Aug-2009)
Setting maximal mount count to 25
Setting current mount count to 999
# tune2fs -l /dev/sda2 | grep -i 'mount count'
Mount count: 999
Maximum mount count: 25
#
sure you can set it to various values.
Actually what is the point? So your answer is to set it to value of 1, and re-set it to a reasonable value >=2 after, by a script at boot with rc2.d? I dont understand what you would like to do with tune2fs.
man tune2fs:
Quote:
DESCRIPTION
tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems. The cur‐
rent values of these options can be displayed by using the -l option to tune2fs(8) program, or by using the dumpe2fs(8) program.
The device specifer can either be a filename (i.e., /dev/sda1), or a LABEL or UUID specifer: "LABEL=volume-name" or "UUID=uuid". (i.e.,
The question is to simulate a single fsck (with -r and auto if possible) at reboot. We never touch the settings (e.g. tune2fs).
You need to first determine what UUID=31c5f001-xx is as a /dev file. Example: is UUID=31c5f001-xx the first partition on the first drive (/dev/sda1), or the second (/dev/sda2), etc.
Once you know that, you can use tune2fs this way to force fsck of /home on the next reboot.
1) run tune2fs -l /dev/sdaX (where X is the partition number). That will give you a list of parameters of /dev/sdaX. The one you are most interested in is Maximum mount count. That tells fsck when to force check of the partition, in number of reboots.
2) The next parameter of interest is Mount count: where the boot count is now relative to Maximum mount count.
3) By setting Mount Count equal to Maximum mount count + 1, that will force fsck to check the partition on the next reboot.
4) As an example, let's say that the Maximum mount count you discover is 20. Then, in a terminal, as root, run tune2fs -C 21 /dev/sdaX to set the Mount count to 21. On next reboot, fsck will check /devsdaX.
5) As an alternative, run tune2fs -c 1 /dev/sdaX to set the Maximum mount count to one, and fsck will check /dev/sdaX on every boot.
Note the difference between the uppercase -C in 4) and lowercase -c in 5).
Last edited by bigrigdriver; 03-03-2013 at 04:50 PM.
And, if the "Maximum mount count" has been set to -1, as was the case in the example I showed, that means that fs check based on mount count is currently disabled, and you will have to set both "Mount count" and "Maximum mount count" in order to force a check.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.