Eu uso o seguinte script perl para verificar quando o próximo fsck ocorrerá:
#!/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;
Eu o tenho executado no meu ~ / .bashrc, então eu sempre sei quando meus sistemas de arquivos serão verificados, embora eu use o ext4 agora que não sofre com os tempos de fsck prolongados, ainda é bom saber.
Saída típica é algo como:
Filesystem /dev/sda1, mounted on / will be checked in 5 mounts
user@localhost ~ $