Page 1 of 3 123 LastLast
Results 1 to 10 of 27

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

  1. #1
    Join Date
    Aug 2006
    Location
    United Kingdom
    Beans
    989
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    HowTo: Change disk checking/fsck at boot frequency

    Hi,

    Nearly all Ubuntu users know, that every 30 boots their system performs what is know as an "fsck" to make sure your hard drive has no errors.

    If you go through periods of frequent rebooting, these checks can become annoying.

    To change how often these boot up checks occur, run this command in a terminal:

    Code:
    sudo tune2fs -c 50 /dev/hda1
    The two things in bold can be modified.

    First, the number "50", which chooses how often you want the check performed. 1 makes it scan at every boot, 0 stops scanning altogether, and all other numbers mean the scan will be performed every ** boots, 20 for 20, 30 for 30, 40 for 40 and so on.

    Next, the "hda1" which you simply change to match the location of your hard drive, be it hda1,2,3 or even sda1,2,3.

    Setting the scan to never happen isn't recommended, I'd say between 50-100 is safe.

    - Matt

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

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

    Nice How-to Old Pink

    This thread has been added to the UDSF wiki.

    Change Disk Check Frequency

    I took the liberty of adding some basic information about fstab:

    fstab options
    /etc/fstab
    is a system configuration file and is used to tell the Linux kernel which partitions (file systems) to mount and where on the file system tree.

    A typical fatab entry may look like this:
    Code:
    /dev/hda1 / ext3 defaults 1 1
    /dev/hdb1 /home ext3 defaults 1 2
    The 6th column (in bold) is a fsck options.
    • 0 = Do not check.
    • 1 = First file system (partition) to check;
      • / (root partition) should be set to 1.
    • 2 = ALL OTHER file systems to be checked.


    bodhi.zazen
    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

  3. #3
    Join Date
    Jul 2006
    Location
    Fortuna, CA
    Beans
    138
    Distro
    Kubuntu 6.10 Edgy

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

    Short of turning it off completely (not recommended) it's still going to happen by surprise and on the computer's timetable. 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?

  4. #4
    Join Date
    Feb 2005
    Location
    Geneva, Switzerland
    Beans
    976

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

    There is also the -i switch to set an interval before the check.
    Code:
    -i interval-between-checks[d|m|w]
    Example combining both methods:
    Code:
    $ sudo tune2fs -c 50 -i 1m /dev/hda1

  5. #5
    Join Date
    Jul 2006
    Location
    Fortuna, CA
    Beans
    138
    Distro
    Kubuntu 6.10 Edgy

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

    Quote Originally Posted by Charles Hand View Post
    Short of turning it off completely (not recommended) it's still going to happen by surprise and on the computer's timetable. 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?
    Here it is:
    Code:
    sudo dumpe2fs -h /dev/sdb1 | grep -i 'mount count'
    Output:
    Code:
    dumpe2fs 1.38 (30-Jun-2005)
    Mount count:              5
    Maximum mount count:      30

  6. #6
    Join Date
    Apr 2006
    Location
    Surrounded by idiots!
    Beans
    1,295
    Distro
    Kubuntu 4.10

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

    Search the forums for "bonager", it is a panel app that warns you of impending scans and lets you postpone them

  7. #7
    Join Date
    Mar 2007
    Beans
    2

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

    There's also a showfsck package (I'm using Edgy in case that matters) with the command "showfsck" to show how many reboots remain before a fsck runs.

  8. #8
    Join Date
    Jul 2007
    Location
    Johannesburg,South Africa
    Beans
    276
    Distro
    Ubuntu

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

    how do i get the Ubuntuuser icon for my website?

  9. #9
    Join Date
    Aug 2007
    Location
    Manresa, Catalunya
    Beans
    7
    Distro
    Ubuntu 7.10 Gutsy Gibbon

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

    I'm learning bash and I wrote this script that shows the "mount count" for each partition. It works fine for me... I hope it helps!
    Code:
    #!/bin/bash
    
    # this directory must exist to execute the script
    if [ -d /dev/disk/by-id/ ]; then :; else echo 'ERROR: /dev/disk/by-id/ does not exist'; exit 1; fi
    
    # root user is necessary
    if [ $UID -gt 0 ]; then	echo 'ERROR: You have to be root'; exit 1; fi
    
    # list ALL partitions and exclude the SWAP ones
    declare -a SWAPS=( $(cat /proc/swaps | grep /dev/ | awk '{print$1}') )
    lsParts="ls -l /dev/disk/by-id/ | grep --regexp=-part[0-9] | awk '{sub(\"../../\",\"/dev/\");"
    for i in $(seq 0 $((${#SWAPS[@]} - 1))); do
    	lsParts=${lsParts}' sub("'${SWAPS[$i]}'", "");'
    done
    lsParts=${lsParts}" print\$10}'"
    declare -a PARTITIONS=(`eval $lsParts`)
    
    # format TEMP file
    for i in $(seq 0 $((${#PARTITIONS[@]} - 1))); do
    	PARTITION=${PARTITIONS[$i]}
    	if [ -n $PARTITION ]; then
    		# first line, device name
    		echo $PARTITION >> .temp.$$
    		# mount info
    		sudo dumpe2fs -h $PARTITION | grep 'Filesystem volume name' >> .temp.$$
    		sudo dumpe2fs -h $PARTITION | grep 'Mount count' >> .temp.$$
    		sudo dumpe2fs -h $PARTITION | grep 'Maximum mount count' >> .temp.$$
    		sudo dumpe2fs -h $PARTITION | grep 'Last mount time' >> .temp.$$
    		sudo dumpe2fs -h $PARTITION | grep 'Last checked' >> .temp.$$
    		echo '-------------------------------' >> .temp.$$
    	fi
    done
    
    # show and delete TEMP file
    clear
    cat .temp.$$
    rm -f .temp.$$
    
    # TUNE help
    echo
    echo 'HOWTO'
    echo -e "- Change Filesystem volume name:\n\tsudo tune2fs -L NewLabel /dev/hda1\n\tsudo e2label /dev/hda1 NewLabel"
    echo
    echo -e "- Change Maximum mount count:\n\tsudo tune2fs -c 50 /dev/hda1"
    echo
    echo -e "- Modify reserved space:\n\tsudo tune2fs -m 1 /dev/hda1"
    echo
    
    exit 0
    Remember that you can call the script like this:
    Code:
    sudo bash ./scriptname.sh
    But if you want to use it more than once, it's better to change the execute permissions and call it without the "bash" command:
    Code:
    chmod 755 ./scriptname.sh
    sudo ./scriptname.sh

  10. #10
    Join Date
    Jul 2007
    Beans
    190

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

    Quote Originally Posted by Old Pink View Post
    Hi,

    Nearly all Ubuntu users know, that every 30 boots their system performs what is know as an "fsck" to make sure your hard drive has no errors.

    If you go through periods of frequent rebooting, these checks can become annoying.

    To change how often these boot up checks occur, run this command in a terminal:

    Code:
    sudo tune2fs -c 50 /dev/hda1
    The two things in bold can be modified.

    First, the number "50", which chooses how often you want the check performed. 1 makes it scan at every boot, 0 stops scanning altogether, and all other numbers mean the scan will be performed every ** boots, 20 for 20, 30 for 30, 40 for 40 and so on.

    Next, the "hda1" which you simply change to match the location of your hard drive, be it hda1,2,3 or even sda1,2,3.

    Setting the scan to never happen isn't recommended, I'd say between 50-100 is safe.

    - Matt
    Nice guide

Page 1 of 3 123 LastLast

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
  •