ForumWie kann ich fsck bei nächstem System Start forcieren ?
piotr – Samstag, 01. Januar 2005 18:49 Uhr

Hallo Gemeinde

Ich habe SUSE 8.2 professional mit Ext3
Wie kann ich fsck bei nächstem System Start forcieren ?
Defaultmässig (glaube ich) wird so ein System Check jede 62 Tage durchgeführt.
Wie oft sollte man solche Checks bei einem produktivem Server durchführen ?

Piotr

3 Antworten
Florian E.J. Fruth – Samstag, 01. Januar 2005 21:34 Uhr

man tune2fs

-C mount-count
Set the number of times the filesystem has been mounted. Can be used in conjunction with -c to force an fsck on the filesystem at the next reboot.

fejf

Murphy – Samstag, 01. Januar 2005 22:10 Uhr

Die Frage ist, warum du fsck eigentlich ausführen willst. Solange keine Fehler aufgetreten sind sehe ich keinen Grund einen Filesystem-Check zu forcieren, ext2 und ext3 sind (wie so ziemlich alle Unix-FS im Gegensatz zu FAT) im laufenden Betrieb normalerweise wartungsfrei. Aber du hast natürlich die Möglichkeit, fsck jederzeit als root auszuführen, sofern das betreffende Laufwerk nicht oder readonly gemountet ist (im Zweifelsfall solltest du das System dazu in den Singleuser-Modus fahren; insbesondere wenn du dir nicht sicher bist was alles für Nebenwirkungen auftreten können).

Christoph – Sonntag, 02. Januar 2005 00:09 Uhr

hi Piotr

tune2fs is used to “tune” a filesystem. This is mostly used to set filesystem check options, such as the maximum mount count and the time between filesystem checks.

It is also possible to set the mount count to a specific value. This can be used to ‘stagger’ the mount counts of the different filesystems, which ensures that at reboot not all filesystems will be checked at the same time.

So for a system that contains 5 partitions and is booted approximately once a month you could do the following to stagger the mount counts:

tune2fs -c 5 -C 0 partition1
tune2fs -c 5 -C 1 partition2
tune2fs -c 5 -C 2 partition3
tune2fs -c 5 -C 3 partition4
tune2fs -c 5 -C 4 partition5

The maximum mount count is 20, but for a system that is not frequently rebooted a lower value is advisable.

[1] http://portal.suse.com/sdb/de/1998/04/rb_fsckerror.html
[2] http://portal.suse.com/sdb/de/1997/07/ke_tune2fs.html

michaelmess – Montag, 29. November 2010 00:49 Uhr

I would recommend to use different maximum mount counts for each partition instead of just giving different mount counts.
The reason is that after a power failure, every partition gets checked and the mount count reset.
Then the next time when a check occurs, all partitions will be checked, if they have the same maximum mount count.

For avoiding that two or more partitions are checked at the same time too often, a good idea is to use prime numbers ( http://en.wikipedia.org/wiki/Prime_number )

Here is a list of prime numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, …
You can also use other numbers as long as two of them won’t share any prime factors.

To stay around 20 (default value, has prime factors 2 and 5 because 20 = 2 * 2 * 5 ) you can use these different maximum mount counts for your five partitions:

17, 19, 20 (=2*2*5), 21 (=3*7), 23

tune2fs -c 17 partition1
tune2fs -c 19 partition2
tune2fs -c 20 partition3
tune2fs -c 21 partition4
tune2fs -c 23 partition5

German version available: http://michaelmess.de/hobbies/linux/tuning/

Ecaroh – Montag, 03. Januar 2005 22:25 Uhr

Hi Piotr!

$ man shutdown # ;-) $ su – # einloggen als `root’ … # shutdown -F -r now # erzwinge fsck bei Neustart …

Gruss, Ecaroh

Hihihi, das ist wohl die kuerzeste Anwort die ich im Forum je gab .. :-))

Harald Geiger – Montag, 03. Januar 2005 22:54 Uhr

# shutdown -F -r now # erzwinge fsck bei Neustart …

Oder falls der Neustart nicht jetzt gleich erfolgen soll: # touch /forcefsck

Harald