The system utility
fsck
(''file system consistency check'') is a tool for checking the consistency of a
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
in
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
and
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating systems, such as
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
,
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
, and
FreeBSD. A similar command,
CHKDSK, exists in
Microsoft Windows and its predecessor,
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few oper ...
.
Pronunciation
There is no agreed pronunciation. It can be pronounced "F-S-C-K", "F-S-check", "fizz-check", "F-sack", "fisk", "fishcake", "fizik", "F-sick", "F-sock", "F-sek", "feshk", the sibilant "fsk", "fix", "farsk" or "fusk".
Use
Generally, fsck is run either automatically at boot time, or manually by the system administrator. The command works directly on data structures stored on disk, which are internal and specific to the particular file system in use - so an fsck command tailored to the file system is generally required. The exact behaviors of various fsck implementations vary, but they typically follow a common order of internal operations and provide a common command-line interface to the user.
Most fsck utilities provide options for either interactively repairing damaged file systems (the user must decide how to fix specific problems), automatically deciding how to fix specific problems (so the user does not have to answer any questions), or reviewing the problems that need to be resolved on a file system without actually fixing them. Partially recovered files where the original file name cannot be reconstructed are typically recovered to a
"lost+found" directory that is stored at the root of the file system.
A
system administrator
A system administrator, or sysadmin, or admin is a person who is responsible for the upkeep, configuration, and reliable operation of computer systems, especially multi-user computers, such as servers. The system administrator seeks to en ...
can also run fsck manually if they believe there is a problem with the file system. The file system is normally checked while unmounted, mounted read-only, or with the system in a special maintenance mode.
Modern
journaling file system
A journaling file system is a file system that keeps track of changes not yet committed to the file system's main part by recording the goal of such changes in a data structure known as a " journal", which is usually a circular log. In the ev ...
s are designed such that tools such as fsck do not need to be run after unclean shutdown (i.e. crash). The
UFS2 file system in
FreeBSD has a background fsck, so it is usually not necessary to wait for fsck to finish before accessing the disk. Full
copy-on-write
Copy-on-write (COW), sometimes referred to as implicit sharing or shadowing, is a resource-management technique used in computer programming to efficiently implement a "duplicate" or "copy" operation on modifiable resources. If a resource is dupl ...
file systems such as
ZFS and
Btrfs
Btrfs (pronounced as "better F S", "butter F S", "b-tree F S", or simply by spelling it out) is a computer storage format that combines a file system based on the copy-on-write (COW) principle with a logical volume manager (not to be confused ...
are designed to avoid most causes of corruption and have no traditional "fsck" repair tool. Both have a "scrub" utility which examines and repairs any problems; in the background and on a mounted file system.
The equivalent programs on
MS-DOS
MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few oper ...
and
Microsoft Windows are
CHKDSK and
SCANDISK.
As an expletive
The severity of file system corruption led to the terms "fsck" and "fscked" becoming used among Unix system administrators as a
minced oath
A minced oath is a euphemistic expression formed by deliberately misspelling, mispronouncing, or replacing a part of a profane, blasphemous, or taboo word or phrase to reduce the original term's objectionable characteristics. An example is "gosh" ...
for "
fuck
''Fuck'' is an English-language expletive. It often refers to the act of sexual intercourse, but is also commonly used as an intensifier or to convey disdain. While its origin is obscure, it is usually considered to be first attested to ar ...
" and "fucked". It is unclear whether this usage was cause or effect, as a report from a question and answer session at
USENIX 1998 claims that "fsck" originally had a different name:
:
Dennis Ritchie: ''"So fsck was originally called something else"''
:Question: ''"What was it called?"''
:Dennis Ritchie: ''"Well, the second letter was different"''
"Go fsck yourself", is occasionally used online as an injunction to a person to go and correct their issue (attitude, ignorance of the subject matter, etc.) - in the same way that running fsck involves fixing fundamental errors.
Examples
The following example checks the file system configured to be mounted on /usr partition; the file system needs to be unmounted first:
fsck /usr
The following example checks the Linux
JFS file system on a mdadm software
RAID device:
fsck -t jfs /dev/md0
See also
*
List of Unix commands
This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.
List
See also
* List of G ...
*
List of file systems
*
e2fsprogs
e2fsprogs (sometimes called the e2fs programs) is a set of utilities for maintaining the ext2, ext3 and ext4 file systems. Since those file systems are often the default for Linux distributions, it is commonly considered to be essential softwar ...
, which includes the
e2fsck
utility, standard on many Linux distributions
*
scrub
Scrub(s) may refer to:
* Scrub, low shrub and grass characteristic of scrubland
* Scrubs (clothing), worn by medical staff
* ''Scrubs'' (TV series), an American television program
* Scrubs (occupation), also called "scrub tech," "scrub nurse," ...
, Oracle Solaris ZFS file system checking utility
References
External links
man fsckChecking and Repairing File system with fsckThe many faces of fsck
{{Unix commands
Computer file systems
Hard disk software
Unix file system-related software