I need to find out what kind of script runs fsck during the boot on CentOS 7? I know that all scenarios are located in /etc/rc.d directory. But I haven't any idea about where is this script is located.
I know that all scenarios are located in
What you know is wrong.
Welcome to CentOS 7. The world has changed. In particular, your base of Red Hat Enterprise Linux 7 has changed. You are using a systemd Linux operating system. A lot of the received wisdom about Linux is not true for such systems.
fsck is not run by any script at all on systemd Linux operating systems.
The native format for systemd is the unit, which can be amongst other things a service unit or a mount unit. systemd's service management proper operates solely in terms of those, which it reads from one of nine directories where (system-wide)
.mount files can live.
/usr/lib/systemd/system are four of those directories.
/etc/fstab database is converted into mount units by a program named
systemd-fstab-generator. This program is listed in the
/usr/lib/systemd/system-generators/ directory and is thus run automatically by systemd early in the bootstrap process at every boot, and again every time that systemd is instructed to re-load its configuration later on.
This program is a generator, a type of ancillary utility whose job is to create unit files on the fly, in a tmpfs where three more of those nine directories (which are intended to be used only by generators) are located.
.mount units that mount the volumes. These in their turn reference
.service units that run
fsck service units don't themselves exist as files in the filesystem (not even in a tmpfs), and are not the products of a generator. They are instantiated by systemd from a template service unit file, named
systemd-fsck@.service, using the device name as the service unit instance name. The instantiation happens because of the
After= references to
firstname.lastname@example.org from the generated
This instantiated template is a service that runs a program named
systemd-fsck, which sets up a client-server connection for displaying progress information and then in its turn runs
systemd-fsck is a compiled C program, not an interpreted script.
- "New Features: System and Services". Red Hat Enterprise Linux 7 Release Notes. Red Hat.
- Stephen Wadeley (2014). "8. Managing Services with systemd" Red Hat Enterprise Linux 7 System Administrators' Guide. Red Hat.
- systemd-fstab-generator. systemd manual pages. Freedesktop.org.
- systemd-fsck@.service. systemd manual pages. Freedesktop.org.
- systemd.mount. systemd manual pages. Freedesktop.org.
If CentOS 7 is still using the SysV setup, under
/etc/rc.d are all scripts, a fast
grep should show where it is called. The scripts themselves are linked (under their names, preceded by precedence) in the
/etc/rc/X directories, untangling that isn't too hard. Understanding the scripts is another kettle of fish altogether...
If it is already using
systemd (look e.g. here for an overview) the configuration files are under
/lib/systemd, and specific configuration is in
/etc/systemd. Again, grap trusty
grep(1) and dig in.