FS-CHECK(8)
β¨ 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 programdfgets run, and its output has to be in a format this program recognizes. when this package was configured, we looked for a suitably compatibledfprogram. but you can override that default, or specify thedfprogram 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 moduleMail::Sendcan be used. but another possibility is an external program. the default program here isMail.--onceβ normally the program runs a disk check and then sleeps a bit. but if the-1or--onceoption is used, the program is run once. one and done, periodt π--pidfile pid file locationβ whenfs-checkstarts 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--onceoption 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:
- what filesystems are checked/excluded. included filesystems are specified with
OWNERand excluded filesystems are specified withEXCLUDEorEXCLUDE_PAT, with optionally aDEFAULTprefix. - at what point to start to complain. a threshold is specified with
LIMITfor filesystem space orILIMITfor inode space, with optionally aDEFAULTprefix. - who to send mail to when there's trouble. a mail contact is specified with
OWNERwith possibly aDEFAULTprefix. - what program to run when there's trouble. a program to run is specified with
ACTIONwith optionally aDEFAULTprefix. - the shortest interval between which we send notifications. this is specified via
MIN_INTERVALwith optionally aDEFAULTprefix.
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 -lsoutput format (the number of fields which may have changed over the years). - Stores temporary files in
/tmpand 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--localwhich 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 β
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
- opensuse-leap 16.0: fs-check 0.9-bp160.1.9 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms