Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: HowTo: Change disk checking/fsck at boot frequency

  1. #21
    Join Date
    Mar 2008
    Beans
    25

    Re: HowTo: Change disk checking/fsck at boot frequency

    I boiled this down into a "universal" command:

    Code:
    sudo tune2fs -c 0 `mount | awk '$3 == "/" {print $1}'`
    I posted further explanation on my web site:
    http://dannyman.toldme.com/2008/11/19/e2fsck-frog-off/

  2. #22
    Join Date
    Dec 2006
    Beans
    6

    Re: HowTo: Change disk checking/fsck at boot frequency

    hi. i run a home server running 24/7 day and night and data is always moving from one hdd to another or some sorts.. is there a way to make it fsck more often? should i just lower the number in the sudo tune2fs -c 50 /dev/hda1 to sudo tune2fs -c 2 /dev/hda1 or something?

    oh, edit: i'm using ext3 on the main boot, and on my other drives, jfs...

    thanks guys.
    Last edited by yangeryanger; February 26th, 2009 at 02:44 AM.

  3. #23
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HowTo: Change disk checking/fsck at boot frequency

    Well, you should not need to run it any more often, especially if you are moving files like that.

    Also fsck should not be run on a mounted partition, so it runs at boot.

    You should be able to run fsck at next boot if you like :

    http://www.cyberciti.biz/faq/linux-f...boot-sequence/
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #24
    Join Date
    Apr 2009
    Location
    Brugge (Be)
    Beans
    14
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HowTo: Change disk checking/fsck at boot frequency

    Quote Originally Posted by dannyman View Post
    I boiled this down into a "universal" command:
    Code:
    sudo tune2fs -c 0 `mount | awk '$3 == "/" {print $1}'`
    I don't use the 'c' (for count) between checks, but the 'i' (for interval).

    So to set the interval every 2 weeks the command becomes:
    Code:
    sudo tune2fs -i 2w `mount | awk '$3 == "/" {print $1}'`
    Every 10 days becomes
    Code:
    sudo tune2fs -i 10d `mount | awk '$3 == "/" {print $1}'`
    Every 3 months becomes
    Code:
    sudo tune2fs -i 3m `mount | awk '$3 == "/" {print $1}'`
    Using the interval allows you to predict more or less when the check will take place (ie every sunday, if you run the command on a sunday with an interval of 7 days)
    Alain J. Baudrez ( My blog )
    Laptop 1 : Ubuntu 10.10/32 bit
    Laptop 2 : Ubuntu 10.04/64 bit
    Nebook : Ubuntu Natty Beta 1 32-bit

  5. #25
    Join Date
    Jun 2009
    Beans
    1

    Re: HowTo: Change disk checking/fsck at boot frequency

    Quote Originally Posted by Charles Hand View Post
    Is there any way to tie into the mechanism that counts the boots and run a little program that says "you're going to have a forced check three boots from now"? Maybe a log file that tells how may boots are left, which could be grepped?
    Using the solutions already suggested you can do something like this:

    Code:
    $ dumpe2fs -h /dev/sda1 2>&1 | grep -i 'mount count' | perl -ne '$i++;chomp;s/.*://;s/\s//g;$arr[$i]=$_;print "Next fsck in " . ($arr[$i] - $arr[1]) . " mounts\n" if($i==2);'
    You can send that to a file by appending:
    Code:
    > /path/to/file
    If you have zenity installed, you can have a popup appear by appending this instead:
    Code:
    | zenity --text-info --title "fsck info"
    I have the last version saved as a shell script which can be set up to run in my startup applications (system|preferences|startup applications|startup programs). Here's that version, which is a bit tidier.

    Code:
    #!/bin/bash
    # fsck mount dialogue hack, by ciderpunx#
    
    dumpe2fs -h /dev/sda1 2>&1 \
    | grep -i 'mount count' \
    | perl -ne '$i++;
                chomp;
                s/.*://;
                s/\s//g;
                $arr[$i]=$_;
                print "Next fsck in " . ($arr[$i] - $arr[1]) . " mounts\n" if($i==2);' \
    | zenity --text-info --title "fsck info"

  6. #26
    Join Date
    Jun 2007
    Beans
    303

    Re: HowTo: Change disk checking/fsck at boot frequency

    Thanks. it saved my time a lot

  7. #27
    Join Date
    Aug 2008
    Beans
    567

    Re: HowTo: Change disk checking/fsck at boot frequency

    Great thread . I know its but I wanted to bring it back to life .

Page 3 of 3 FirstFirst 123

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •