Skip to content

Commit

Permalink
Add -q option to fsck to check for zero-byte cache files quickly (cvm…
Browse files Browse the repository at this point in the history
  • Loading branch information
vvolkl committed Dec 6, 2024
1 parent 824c122 commit df5ddbd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions cvmfs/cvmfs_config
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ cvmfs_config_usage() {
echo " stat [-v | <repository>]"
echo " status"
echo " probe [<repository list>]"
echo " fsck [<cvmfs_fsck options>]"
echo " fsck [-q(uick check for zero byte files only) | <cvmfs_fsck options>]"
echo " fuser <repository>"
echo " reload [-c | <repository>]"
echo " umount"
Expand Down Expand Up @@ -1294,9 +1294,19 @@ cvmfs_config_fsck() {
continue
fi

echo "CernVM-FS fsck on $dir"
cvmfs_fsck $@ $dir
retval=$(($? + $retval))
if [ "x$1" = "x-q" ]; then
# this hardcodes the hash for the (legitimately) empty file - if anything about compression or hashing changes,
# this needs to be updated
for zeroed_file in $(find $dir -empty -wholename "$dir/[a-z0-9][a-z0-9]/*" ! -name ec3d88b62ebf526e4e5a4ff6162a3aa48a6b78); do
echo "WARNING: unexpected zero-byte file $zeroed_file - Moving it to quarantaine."
mv $zeroed_file $dir/quarantaine
retval=1
done
else
echo "CernVM-FS fsck on $dir"
cvmfs_fsck $@ $dir
retval=$(($? + $retval))
fi
done

return $retval
Expand Down

0 comments on commit df5ddbd

Please sign in to comment.