FS-CHECK(8)

πŸ“¦ version 0.9, in opensuse-leap 16.0

✨ fs-check(8) β€” the disk-usage watchgirl πŸ’…

okay bestie, so this is fs-check from section 8 of the manual, and she is literally the daemon that keeps an eye on your disks so they don't sneak up on you and fill up. no cap.


🌸 NAME 🌸

fs-check β€” size report daemon/program πŸ¦‹


⭐ SYNOPSIS ⭐

fs-check [options...] [directory]

Checks the disk usage locally for filling or full filesystems.

πŸ’– DESCRIPTION πŸ’–

So fs-check checks the disk usage locally, as reported by the command, for filesystems that are filling or full. She figures out which filesystems to check, what threshold to use for an alert, and what to do about it β€” all based on a configuration file you get to customize yourself. main character energy fr fr πŸ‘‘

The program records its process id in the file. And if it receives a -HUP signal, the configuration file gets reread. slay, live config updates ✨


πŸŽ€ OPTIONS πŸŽ€

  • --help β€” gives you rudimentary help and then exits. bare minimum but she tried πŸ’…
  • --version β€” shows a CVS version string and exits.
  • --debug integer β€” gives debugging output. the higher the number, the more output you get. default is no debug information (0).
  • --df path to df-program and options β€” so to get filesystem size info, the program df gets run, and its output has to be in a format this program recognizes. when this package was configured, we looked for a suitably compatible df program. but you can override that default, or specify the df program explicitly, with this option.

The default is

/bin/df -t jfs -t ext2 -t ext3 -t ntfs -t reiserfs -t vfat --local
  • --mail mail program β€” when a threshold has been exceeded, a report is usually mailed out. the Perl module Mail::Send can be used. but another possibility is an external program. the default program here is Mail.
  • --once β€” normally the program runs a disk check and then sleeps a bit. but if the -1 or --once option is used, the program is run once. one and done, periodt πŸ’€
  • --pidfile pid file location β€” when fs-check starts as a daemon it writes its process id in a file.

normally you shouldn't have to set this or worry about it. the default is /var/run/fs-check.pid 🫢

  • --sleep seconds β€” when this program is run as a daemon (like, when the --once option is not in effect), the period to wait in seconds between checks is set by this parameter. 😴
  • --timeout seconds β€” when one of the thresholds for a filesystem is exceeded, a program or script gets executed. the maximum time used in executing that program can be set with --timeout. ⏰

πŸ¦‹ CONFIGURATION FILE FORMAT πŸ¦‹

A configuration file for fs-check specifies:

  1. what filesystems are checked/excluded. included filesystems are specified with OWNER and excluded filesystems are specified with EXCLUDE or EXCLUDE_PAT, with optionally a DEFAULT prefix.
  2. at what point to start to complain. a threshold is specified with LIMIT for filesystem space or ILIMIT for inode space, with optionally a DEFAULT prefix.
  3. who to send mail to when there's trouble. a mail contact is specified with OWNER with possibly a DEFAULT prefix.
  4. what program to run when there's trouble. a program to run is specified with ACTION with optionally a DEFAULT prefix.
  5. the shortest interval between which we send notifications. this is specified via MIN_INTERVAL with optionally a DEFAULT prefix.

Lines with # in column 1, or blank lines, are ignored. actually, any line that doesn't match a valid line is ignored. πŸ™ˆ

So what isn't ignored? lines that begin in column 1 with EXCLUDE, EXCLUDE_PAT, OWNER, LIMIT, ACTION, or DEFAULT. below we give the format of each of these directives.

Case is not significant.

EXCLUDE mount-point
EXCLUDE_PAT mount-point-regexp
OWNER  mount-point email-address amount full
OWNER mount-point  email-address
LIMIT mount-point amount full
ILIMIT mount-point amount full
ACTION mount-point script-or-program
MIN_INTERVAL mount-point seconds
DEFAULT OWNER email-address
DEFAULT OWNER email-address amount full
DEFAULT LIMIT amount full
DEFAULT ILIMIT amount full
DEFAULT ACTION script
DEFAULT MIN_INTERVAL seconds

amount full is either the percentage of the disk full or the number of bytes that need to be available. the way we distinguish the first case from the second is to add a K, KB, M, MB, G, or GB at the end. an optional % can be used to specify percent for more clarity, although if just a number is used it's taken as a percentage. πŸ’―

For example default 90 and DEFAULT 90% are the same thing, and mean that mail should be sent out on any disk that's 90% or more full β€” unless otherwise specified by a more specific LIMIT, ILIMIT or OWNER (with amount) line. iykyk 🌈

In contrast, 4096KB, 4096k, or 4MB means that 4 megabytes must be available on the disk. you may want to use this form for, say, the root partition. πŸ‘‘

If there are many lines which refer to the same disk, or change the default (which can be done in a couple ways), the last one sticks. last one wins, no takebacks πŸ’€


🌈 SAMPLE CONFIGURATION FILE 🌈

# This is who gets mail when something's wrong and no further specification
default owner  rocky 95%

# This is the program to run when no other program is specified...
default action /usr/local/bin/fs-report

# Limit at which to complain about i-nodes...
default ilimit 99%

# Don't sent out notifications if they occur less than 30 minutes
# (1800 seconds) from the last notification
default min_interval 1800

# The limits for the directory which holds /tmp should not be
# too close to the maximum limit. The file system checker stores its
# temporary data there. So if this is too full, we won't get a useful
# report back.
#limit   /      70%
#limit   /var   90%
#limit   /usr 95%
#limit   /src   90%
limit    /home        90%
action  /var /usr/local/bin/fs-report --nocore

# Don't check any filesystem starting /cdrom...
exclude_pat ^/mnt/cdrom
exclude_pat ^/cdrom

# Filesystems not listed, e.g /home, would be checked as they come
# under the default. If you want a disk exclude them, create/uncomment
# an exclude line such as the one below.
exclude /mnt/floppy
exclude /mnt/msfloppy
exclude /mnt/cdrom
exclude /mnt/cdrom2
exclude /mnt/dvd

πŸ”₯ SECURITY CONSIDERATIONS πŸ”₯

okay so real talk for a sec 🫢 β€” any daemon such as this one which is sufficiently flexible is a security risk. the configuration file allows arbitrary commands to be run. in particular, if this daemon is run as root and the configuration file is not protected so that it can't be modified, a bad person could have their programs run as root. 😭 that's not a vibe.

There's nothing inherent in fs-check that requires one to run this daemon as root.

So as with all daemons, one needs to take the usual security precautions that a careful sysadmin/maintainer of a computer would. if you can run any daemon as an unprivileged user (or with no privileges), do it! if not, set the permissions on the configuration file and the directory it lives in. commands that need to be run as root you can run via sudo. on Solaris, I often run process accounting which tracks all commands run. Tripwire may be useful to track changed configuration files. πŸ’œ


🧚 TROUBLESHOOTING 🧚

To debug a configuration file, the following options are useful:

fs-check --norun -1 --debug 2 *configuration-file*

For even more information and control, try running the above under the Perl debugger, e.g.

perl -d fs-check --norun -1 --debug *configuration-file*

πŸ’œ SEE ALSO πŸ’œ

My log rotation program <http://recycle-logs.sourceforge.net> and file removal/archival program <http://rm-old-files.sourceforge.net> might assist in maintenance the filesystem so it doesn't fill up. πŸŽ€


πŸ’€ BUGS πŸ’€

Has a number of Unixisms and non-generalities:

  • assumes Unix file separator path /
  • assumes spaces delimit filenames (no embedded blanks)
  • GNU find -ls output format (the number of fields which may have changed over the years).
  • Stores temporary files in /tmp and assumes there's space for whatever we need to do in that
  • That our mount-pount to filename conversion (/ => --) will not get confused with a valid mount point. for example one could have a mount point called /usr--local which we'll confuse with /usr/local.

Please volunteer to fix any of these. πŸ™ bestie we're begging


🌸 AUTHOR 🌸

The current version is maintained (or not) by rocky@cpan.org. 🫢


  Copyright (C) 2004, 2005, 2005, 2006 Rocky Bernstein, email: rocky@cpan.org.
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GNU Make; see the file COPYING.  If not, write to the
  Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  MA 02111-1307, USA.
$Id: fs-check.in.in,v 1.27 2006/02/27 08:22:56 rockyb Exp $

and that's the whole page, bestie β€” this one shipped as perl v5.8.8, dated 2007-03-30, and it's been iconic ever since πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from