[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7   8   9   10   11   12 [ Index of Past Answers ]


(?) The Answer Gang (!)


By Jim Dennis, Ben Okopnik, Dan Wilder, Breen, Chris, and... (meet the Gang) ... the Editors of Linux Gazette... and You!
Send questions (or interesting answers) to The Answer Gang for possible publication (but read the guidelines first)


(?) ext3 filesystemcheck?

From Karl-Heinz Herrmann

Answered By Johan H, Ben Okopnik, Jay R. Ashworth, John Karns

(?) [K.-H.]

Hi,

since the advertising of ext3 here on the list lately I changed as well. So I got myself the new e2fsprogs-1.25.tar.gz and the new package including mount which knows about ext3.

tunefs my ext2 partitions to have a journal, changes fstab entries and on reboot ext3 messages. nice.

(!) [Heather] Here's a note on making the conversion - though I'll warn that you no longer need to chase down the patches, as they're pretty well merged these days. And ask your current copy of tune2fs about the command options: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html

(?) [K.-H.] Now today it told me that after 20 remounts it is going to check my filesystem and it was running e2fsck (1.25 Sep 2001) on the partition. It found some minor i-node problems, corrected automatically and after that the normal ext3 messages during the mount stage came up and everything seemd fine.

So:

Is this normal behaviour of ext3? Should I switch off the fschk in the /etc/init.d/boot for the ext3 partitons? The system is a SuSE 7.1 which does not know about ext3 yet. reiserfs is explicitly handled in the boot script as reiser is installed and configured by SuSE.

And I'm wondering what happens if the system is not shutdown cleanly. I'm not too keen on trying right now....

Thanks for hints,

(!) [Johan] The fsck parameters are kept in the filesystem itself.
## This will disable forced fsck after a certain number of mounts.
 tune2fs -c 0 /dev/${partition.}
in my case
  tune2fs -c 0 /dev/hda1

## This will disable forced fsck after a certain period
 tune2fs -i 0 /dev/${partition.}
in my case
  tune2fs -i 0 /dev/hda1
`$ man tune2fs' for details.
Kind regards Johan H
(!) [Ben] <Wince> That's probably not a good idea. I would set it to some reasonably high number, but never running 'fsck' would give me the hives. Mine is set to 100, something I consider a reasonable "cleanliness vs. annoyance" value.

(?) [K.-H.] thanks to both for the fast reply,

So even with ext3 journaling it's advisable to run fsck occasionally? And running a reasonably new fsck.ext3 (which actually runs e2fsck 1.25) is ok? Will not damage anything -- also not in case of an unclean shutdown? In case of an unclean shutdown it should just replay the journal and not actually run a full fsck, right?

Then I would set the various partitons on the one HD to some largish 2 digit prime numbers and let an occasional fsck run on them.

(!) [Johan]
$ uptime on 3 machines.
 5:44pm  up 28 days,  6:28,  3 users,  load average: 0.00, 0.00, 0.00
 5:50pm  up 23 days,  5:09,  2 users,  load average: 0.00, 0.00, 0.00
 5:46pm  up 32 days,  3:52,  1 user,  load average: 0.02, 0.07, 0.03
Uptime on my servers are huge. With autofsck set to one hundred mounts, you will run fsck maybe once every 8 years? Yes it is good to run fsck occasionally, I prefer not running it while it is booting. I have enough trouble on my hands when a 100Gb SCSI machine falls over. It takes nearly 20 mins to fsck that beast.

(?) [K.-H.] nice uptimes, yes. The typical uptime of my Laptop is about twice rebooted per day -- once at home and once at work....

(!) [Jay] Doesn't your laptop's suspend cooperate? My laptop typically only gets rebooted when I blow standby time, or on those occasions that it's intermittent bites me.

(?) [K.-H.] not really. IF I stop X AND unload the NVidia driver it will suspend and may come back up. Most of the time not and I got tired of the fscks after failed tries. And S2D is not configured (yet). But not worth doing anyway -- repartitioning or at least resizing would be necessary due too a RAM upgrade recently and if I've to drop down to text-login I anyway can't preserve whatever I was working on on the screen.

The reboot without any fscks is fast enough for me. I think I'll setup fsck to start after time intervalls instead of remounts... that should be more calculable.

(!) [Johan] The only difference between ext2 and ext3 is the journal. You can mount an ext3 fs as ext2. So yes, it is good to run fsck at regular intervals. I prefer to schedule mine, others prefer the mount count to do it. Choose what suits you best.

(?) [John] OK, but in order to make adjustments, doesn't fsck need to be run the fs when mounted as read-only? And IIRC, running it on the fs when mounted rw can screw things up, no?

(!) [Johan] Absolutely right, the safe way is,
## single user mode
init 1;

## remount / in read only mode.
mount -o remount,ro /
e2fsck /dev/hda1

## remount / in readwrite mode
mount -o remount,rw /

## back to where you came from
init 3
(!) [Jay] Make sure not to do /dev/hda itself -- it's the entire drive. The thing you're fsck'ing has to be a partition of the ext3 variety.

(?) [K.-H.] That is setup by SuSE quite ok -- initially / is mounted ro, checked, then all others are checked with special treatment for reiserfs, all other partitions are still unmounted at the point.

Then / will be remounted for rw and all other get mounted and system runlevel changes to the specified one (2 in my case, which is multi-user, network but textloging).

I was just wondering if I'm supposed to run fsck on ext3 at all -- but that is cleared up by now.

just running a fsck from time to time is maybe more convenient. I would like to avoid random longish boottimes -- it's always when you wait for the Lap to came up fast with somebody next to you.

(!) [Johan] When things go bang in the server room, it should just replay the journal. This has two advantages, faster mounting after machine crashes and guaranteed integrity of the fs structure(Not the data btw).

(?) [K.-H.] data not yet written are lost -- certainly. but their space should be correctly allocated and meta data should be intact as you said.

(!) [Jay] Yep, just like an fsck, journals only preserve FS structure, not necessarily data -- an important point to make, since journal fans seem to want to suggest that they can preserve data.
(!) [Heather] Here is an article describing in some detail what ext3 does -- the author digs on the other journaling filesystems a bit, and seems to know a bit about how Reiser ticks too. Apparently ext3 is better than most at preserving data in files that already existed, at least: http://www-106.ibm.com/developerworks/linux/library/l-fs7


This page edited and maintained by the Editors of Linux Gazette Copyright © 2002
Published in issue 76 of Linux Gazette March 2002
HTML script maintained by Heather Stern of Starshine Technical Services, http://www.starshine.org/


[ Table Of Contents ][ Answer Guy Current Index ] greetings   Meet the Gang   1   2   3   4   5   6   7   8   9   10   11   12 [ Index of Past Answers ]