![]() |
ubuntu.com - launchpad.net - ubuntu help
|
|
|||||||
|
Tutorials & Tips The place to find Ubuntu related Tips & Tricks. |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Dark Roasted Ubuntu
![]() |
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 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
__________________
Remember when you were young? You shone like the sun. Now there's a look in your eyes, like black holes in the sky. Shine On You Crazy Diamond. Topical Matt: home | the iphone alternatives |
|
|
|
|
|
#2 |
|
Ubuntu Guru
![]() |
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
bodhi.zazen
__________________
A person with ubuntu is open and available to others, affirming of others, does not feel threatened that others are able and good, for he or she has a proper self-assurance that comes from knowing that he or she belongs in a greater whole and is diminished when others are humiliated or diminished, when others are tortured or oppressed. ~ Archbishop Desmond Tutu, 1999 ![]() |
|
|
|
|
|
#3 |
|
A Carafe of Ubuntu
![]() Join Date: Jul 2006
Location: Fortuna, CA
Beans: 138
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 |
|
Dark Roasted Ubuntu
![]() |
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] Code:
$ sudo tune2fs -c 50 -i 1m /dev/hda1
__________________
Search before posting new threads ! Community Documentation | UbuntuGuide Ask questions the smart way |
|
|
|
|
|
#5 | |
|
A Carafe of Ubuntu
![]() Join Date: Jul 2006
Location: Fortuna, CA
Beans: 138
Kubuntu 6.10 Edgy
|
Re: HowTo: Change disk checking/fsck at boot frequency
Quote:
Code:
sudo dumpe2fs -h /dev/sdb1 | grep -i 'mount count' Code:
dumpe2fs 1.38 (30-Jun-2005) Mount count: 5 Maximum mount count: 30 |
|
|
|
|
|
|
#6 |
|
Fresh Brewed Ubuntu
![]() Join Date: Apr 2006
Location: Surrounded by idiots!
Beans: 1,294
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 |
|
First Cup of Ubuntu
![]() 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 |
|
Way Too Much Ubuntu
![]() Join Date: Jul 2007
Location: Johannesburg,South Africa
Beans: 267
Ubuntu 9.04 Jaunty Jackalope
|
Re: HowTo: Change disk checking/fsck at boot frequency
how do i get the Ubuntuuser icon for my website?
|
|
|
|
|
|
#9 |
|
First Cup of Ubuntu
![]() Join Date: Aug 2007
Location: Manresa, Catalunya
Beans: 7
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
Code:
sudo bash ./scriptname.sh Code:
chmod 755 ./scriptname.sh sudo ./scriptname.sh |
|
|
|
|
|
#10 | |
|
Gee! These Aren't Roasted!
![]() Join Date: Jul 2007
Beans: 161
|
Re: HowTo: Change disk checking/fsck at boot frequency
Quote:
|
|
|
|
|
| Bookmarks |
| Tags |
| disk check, fsck |
| Thread Tools | |
| Display Modes | |
|
|