![Forrest logo](/images/logo.png)
e2fsck
e2fsck is a command-line tool used in Unix-like operating systems to check and repair ext2, ext3, ext4 file systems. It stands for "ext2 file system checker" and is primarily used to fix any inconsistencies or errors that may be present in the file system structures. e2fsck checks the integrity of the file system by scanning the entire disk or partition for errors, including bad blocks, incorrect metadata, and corrupted data structures. It ensures that the file system is in a consistent and usable state, preventing any potential data loss or system failures. e2fsck also has the ability to automatically repair detected errors, thereby restoring the file system to a healthy condition. The tool provides various options and flags to customize its behavior, including the ability to run in interactive mode, specify the file system type explicitly, or check specific partitions or disks. e2fsck can be run either from the command line or during the system boot process when the root file system is mounted as read-only. It is typically used when a file system check hasn't been performed for an extended period, after an unexpected system shutdown, or when prompted by the operating system upon detecting potential issues. The output of e2fsck displays detailed information about the checks performed, any detected errors, and the status of the file system after the repair process. Overall, e2fsck is a crucial tool for maintaining and repairing ext2, ext3, and ext4 file systems, ensuring their reliability and data integrity.
List of commands for e2fsck:
-
e2fsck:tldr:0f860 e2fsck: Check filesystem, reporting any damaged blocks.$ sudo e2fsck ${-dev-sdXN}try on your machineexplain this command
-
e2fsck:tldr:85556 e2fsck: Perform an exhaustive, non-destructive read-write test for bad blocks and blacklist them.$ sudo e2fsck -fccky ${-dev-sdXN}try on your machineexplain this command
-
e2fsck:tldr:9c0cb e2fsck: Check filesystem in read only mode.$ sudo e2fsck -c ${-dev-sdXN}try on your machineexplain this command
-
e2fsck:tldr:c3a6f e2fsck: Check filesystem and automatically repair any damaged blocks.$ sudo e2fsck -p ${-dev-sdXN}try on your machineexplain this command