LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 03-03-2013, 09:34 AM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,649

Rep: Reputation: 255Reputation: 255Reputation: 255
fsck.ext3 about boot?


Hi,

I would like to ask a simple question, in direction of best way.

To fsck a disk at boot one can use the touch /forcefsck.

I would like to check the /home at the next reboot, so that it reboots automatically and check the disk /home before mounting it.

fstab has:
Code:
UUID=31c5f001-xx     /home   ext3     defaults        0       2
Which way would you advice to tell Debian to do this operation at next reboot?

Many thanks
 
Old 03-03-2013, 11:22 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,767

Rep: Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209
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
#
 
Old 03-03-2013, 11:53 AM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,649

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by rknichols View Post
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).

Last edited by Xeratul; 03-03-2013 at 11:55 AM.
 
Old 03-03-2013, 04:36 PM   #4
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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.
 
Old 03-03-2013, 05:44 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,767

Rep: Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209Reputation: 2209
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Long fsck.ext3 like at boot? Xeratul Linux - General 2 05-18-2012 01:10 PM
Recovering 1Tb ext3 with fsck.ext3 JoeShearn Linux - General 6 05-20-2011 10:12 PM
External USB Drive Ext3 Fsck Error on Boot anon111 Linux - Desktop 8 08-22-2009 12:02 AM
Removing external drive causes boot failure: fsck.ext3: unable to resolve... David Marks Linux - Hardware 6 06-23-2009 10:14 AM
Occasional fsck.ext3 Error at Boot Time - FC5 JonBL Linux - Hardware 2 01-25-2007 04:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration