The fsck command on Linux is actually a “wrapper” used to call other commands that are variations of fsck for various types of file systems.
You can see this with the ls command in the /usr/sbin directory:
$ ls -l /usr/sbin/ *fsck*
lrwxrwxrwx 1 root March 8 2019 /usr/sbin/dosfsck -> fsck.fat
-rwxr-xr-x 4 root 256424 Jul 26 2018 /usr/sbin/e2fsck
-rwxr-xr-x 1 root root 49896 Jul 26 2018 /usr/sbin/fsck k
-rwxr-xr-x 1 root root 37200 July 26 2018 /usr/sbin/fsck.cramfs
-rwxr-xr-x 4 root root 256424 July 26 2018 /usr/sbin/fsck.ext2
-rwxr-xr-x 4 root root 256424 Jul 26 2018 /usr/sbin/fsck.ext3 -rwxr-xr-x 4 root root 256424 July 26 2018 /usr/sbin/fsck.ext3
-rwxr-xr-x 4 root 256424 July 26 2018 /usr/sbin/fsck.ext3 sck.ext4
-rwxr-xr-x 1 root root 57424 ago 2 2018 /usr/sbin/fsck.fat
-rwxr-xr-x 1 root root 83536 July 26 2018 /usr/sbin/fsck.minix
lrwxrwx 1 root root March 8 2019 /usr/sbin/fsck.msdos -> fsck.fat lrwxrwxrwx 1 root March 8 2019 /usr/sbin/fsck.msdos -> fsck.fat
lrwxrwxrwx 1 root March 8 2019 /usr/sbin/fsck.vfat fsck.fat
-rwxr-xr-x 1 root root 433 Jan 24 2019 /usr/sbin/fsck.xfs
Depending on the file system, fsck invokes fsck. something appropriate to handle that file system.
The purpose of fsck is to check and correct the file system for errors. By default, fsck takes over the ext2 file system and, after checking the disk, asks the user if they wish to make the necessary corrections.
As a parameter, fsck accepts a device name (e.g.: /dev/hdc1, /dev/sdb2), a mount point (e.g./, /usr, /home), or a Label (e.g.: label=Root) or a UUID disk identification (e.g.: uuid=8868abf6-88c5-4a83-98b8-bfc24057f7bd).
A UUID is a unique number that identifies a disk, as if it were the “MAC Address of the disks”.
Frequently used options are:
We may still have some options for the ext2 file system:
A superblock is a special area on the disk containing important information about the file system parameters and their current state. Generally, the superblock is copied to various areas on the disk as a backup.
The fsck needs the disc to be disassembled to perform the checks and repairs:
# fsck /dev/xvdb1
/dev/xvdb1 is in use.
Once the file system is unmounted:
# fsck.ext4 /dev/xvdb1 e2fsck 1.42.9 (28-Dec-2013) /dev/xvdb1: clean, 41436/524288 files, 374905/2096891 blocks
Depending on the size and the numerous repairs that the partition requires, the fsck process can take hours.
To check the root system partition there are two options:
The e2fsck command is used to check the ext2, ext3, and ext4 file system. It is the version of fsck for file systems based on the ext file system.
The options are common to fsck, since fsck invokes it when it comes to ext2, ext3, and ext4 partitions.
Example:
$ sudo fsck.ext4 /dev/xvdb1 e2fsck 1.42.9 (28-Dec-2013) /dev/xvdb1: clean, 41436/524288 files, 374905/2096891 blocks
The sudo command on Linux executes a given command as if it were another user.…
The ss command on Linux is extremely useful for investigating sockets, providing various information about…
Free Linux command shows the amount of total memory in use and available, as well…
The shell has structures for testing conditions and executing certain program sequences several times (loop),…
The /etc/fstab file stores the configuration of which devices should be mounted and what is…
The Netcat Command in Linux or nc is a utility used to do “almost anything”…
This website uses cookies.