forced fsck (again?)
Theodore Tso
tytso at mit.edu
Sat Jan 26 04:33:34 UTC 2008
On Fri, Jan 25, 2008 at 01:55:57AM -0700, Andreas Dilger wrote:
> > nice logsave -as "${tmpfile}" fsck.${fstype} -p -C 0 "$dev" &&
> > nice logsave -as "${tmpfile}" fsck.${fstype} -fy -C 0 "$dev"
>
> Hmm, I'm not sure I understand what it is you want to do? The fsck should
> be run as 'e2fsck -fn "$dev"' (since we already know this is ext2|ext3).
> Using "-C 0" isn't useful because we don't want progress in the output log,
This was my fault. It means that when you run this from a tty, you
get to see the progress bar. The -s flag to logsave will strip out
the progress information. (I added logsave -s precisely for this
purpose. :-)
> and "-p" without "-f" will just check the superblock.
That's needed e2fsck -p will clean up the orphaned inode list, so that
the subsequent e2fsck -fy will return 0 if the filesystem is clean.
Without the the fsck -p, then e2fsck -fy will return 1 (because it
modified the filesystem) which we can't distinguish from the case
where the filesystem had errors.
> We don't want to be
> fixing anything (since this should be a read-only snapshot) so "-fy" is
> also not so great.
This is a tradeoff. e2fsck -fy requires that the snapshot have more
space (although if you run off, it's not that horrible; the snapshot
will just go invalid). The advantage of "-fy" is that you get more
information about any errors in the filesystem, where as "-fn" may not
report as useful information.
> > # do everything needed to check and reset dates and counters on /dev/$1/$2.
> > function check_fs() {
> > local tmpfile=`mktemp -t e2fsck.log.XXXXXXXXXX`
> > trap "rm $tmpfile ; trap - RETURN" RETURN
>
> For the log file it probably makes sense to keep this around with a
> timestamp if there is a failure. That means it is fine to generate a
> random filename temporarily, but it should be renamed to something
> meaningful (e.g. /var/log/lvfsck.$dev.$(date +%Y%m%d) or similar).
The idea is if there is a failure we'll e-mail to the administrator;
after that, there's no real need to keep it around.
- Ted
More information about the Ext3-users
mailing list