Utilizo el siguiente script perl para verificar cuándo ocurrirá el siguiente fsck:
#!/usr/bin/perl -w
use strict;
my $mountcount = 0;
my $maxmount = 0;
my $dev;
my $mountpoint;
my $fstype;
my $debug = 0;
my $cmd = "mount";
open MOUNT, sprintf ( "%s |", $cmd ) or die sprintf ( "ERROR: Cannot execute %s - %s\n", $cmd, $! );
while ( <MOUNT> ) {
chomp;
( $dev, undef, $mountpoint, undef, $fstype, undef ) = split;
printf "Found device %s\n", $dev if ( $debug > 0 );
if ( $fstype =~ /^ext/i ) {
$cmd = sprintf "dumpe2fs -h %s 2>&1", $dev;
open DUMPE2FS, sprintf ( "%s |", $cmd ) or die sprintf ( "ERROR: Unable to execute %s - %s\n", $cmd, $! );
while ( <DUMPE2FS> ) {
chomp;
if ( /^Mount count:/ ) {
( undef, $mountcount ) = split /:/;
$mountcount =~ s/\s*//g;
printf "Mount count = %s\n", $mountcount if ( $debug > 0 );
}
if ( /^Maximum mount count:/ ) {
( undef, $maxmount ) = split /:/;
$maxmount =~ s/\s*//g;
printf "Maximum mount count = %s\n", $maxmount if ( $debug > 0 );
}
}
close DUMPE2FS;
printf "Filesystem %s, mounted on %s will be checked in %s mounts\n", $dev, $mountpoint, $maxmount - $mountcount;
}
}
close MOUNT;
Lo tengo ejecutado en mi ~ / .bashrc, así que siempre sé cuándo se verificarán mis sistemas de archivos, aunque ahora uso ext4 que no sufre de tiempos de fsck extendidos, todavía es bueno saberlo.
La salida típica es algo como:
Filesystem /dev/sda1, mounted on / will be checked in 5 mounts
user@localhost ~ $