Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 11-12-2010, 03:07 AM   #1
LQ Newbie
Registered: Nov 2005
Location: Italy
Distribution: Slackware 12.1
Posts: 22

Rep: Reputation: 0
Fsck and Manually mounted filesystems


I want the filesystem of my external drive to be checked periodically after a numer of mounts.

I put 2 in the sixth colums of fstab for this partition

/dev/sdb1		/mnt/hd	ext3	rw,dev,sync,user,noauto,exec,suid	0	2
and I use the tune2fs to set the maximum mount count to 32.

tune2fs -c 32 /dev/sdb
now the mount count is 34 and the date of the last check is not recent, so apparently the auto fsck has not been performed.

Probably because this partition is not mounted at start-up but I usually mount it manually.

This maybe a silly question but can someone explain me where is my mistake??
Old 11-12-2010, 04:24 AM   #2
LQ Newbie
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0

You can try out another method for auto fsck in order to perform the fsck for each partitions while booting.

 touch /forcefsck
Touch the file forcefsck in all the partitions you wanted fsck'd.

Please give a try...!!!!!

Best Value Support
Old 11-12-2010, 07:28 AM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Linux only checks file systems to see if they are due for an fsck during boot so the check is not done when they are manually mounted after boot.

One solution would be to mount via a script which checks whether a fsck is due. Here's some sample code
# fsck if required
# ~~~~~~~~~~~~~~~~
buf=$( blkid $partition_dev_file )
case $fs_type in
    ext* )
        buf=$( tune2fs -l $partition_dev_file )
        buf=${buf##*Mount count:*( )}
        buf=${buf##*Maximum mount count:*( )}
        if [[ $mount_count -ge $max_mount_count ]]; then
            msg I "$partition_dev_file ready for fsck (mount count: $mount_count, maximum mount count: $max_mount_count)"
            # fsck option -p is OK for fsck.ext[234]
            buf=$( fsck -Tp $partition_dev_file 2>&1 )
            msg I "fsck return code $rc, output:"$'\n'"$buf"
    * )
        msg E "DEVELOPMENT: unserviced file system type $fs_type; script needs developing"
Old 11-12-2010, 08:32 AM   #4
LQ Newbie
Registered: Nov 2005
Location: Italy
Distribution: Slackware 12.1
Posts: 22

Original Poster
Rep: Reputation: 0
Thanks catkin nice script!!!


touch /forcefsck
does not work since

Linux only checks file systems to see if they are due for an fsck during boot
and I need when manually mount.


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
Changing how filesystems are mounted kaplan71 SUSE / openSUSE 2 02-23-2009 04:48 PM
'Checking filesystems fsck.ext3: Unable to resolve UUID amadain Fedora - Installation 2 12-07-2008 07:41 AM
computer asks me to run a FSCK Manually, but won't : says can't run on mounted lightwave Linux - Newbie 12 04-02-2008 12:25 AM
fsck manually adityavpratap Slackware 3 01-01-2007 06:05 AM
mounted devices/ filesystems ergo_sum Linux - Newbie 4 11-01-2003 05:43 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:39 PM.

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