Forrest logo
back to the e2fsck tool

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 machine

The command "sudo e2fsck -fccky ${-dev-sdXN}" is used to run a file system check on a specific partition of a device using the e2fsck tool.

Here's a breakdown of the command:

  • "sudo": It is a command that allows you to run another command as the superuser or root user. It is used to provide administrative privileges for executing the following command.

  • "e2fsck": It is a command-line tool used to check and repair ext2, ext3, and ext4 file systems commonly found in Linux operating systems.

  • "-f": This flag or option stands for "force." It forces e2fsck to perform a file system check by ignoring warnings or prompts from the user. It is typically used when automating system maintenance tasks.

  • "-c": This flag enables the bad block checking feature. e2fsck will read every block of data on the file system and verify if it is readable or not. It helps to identify and mark any bad blocks on the disk.

  • "-ck": These two flags together enable the interactive mode of e2fsck. It prompts the user to confirm fixes before applying them. It allows the user to intervene and make decisions during the file system check and repair process.

  • "-y": This flag is used to automatically reply "yes" to any prompts or questions asked by e2fsck. It is handy when running the command in a non-interactive or automated environment, as it prevents the process from getting stuck waiting for user input.

  • "${-dev-sdXN}": This is a placeholder variable representing the partition you want to check. "sdXN" denotes the disk (e.g., sda, sdb, etc.) and partition number (e.g., 1, 2, etc.) you want to run the file system check on. You need to replace "${-dev-sdXN}" with the actual device and partition you want to check (e.g., /dev/sdb1).

In summary, the "sudo e2fsck -fccky ${-dev-sdXN}" command runs an extensive file system check on a specific partition, forcing it to check for bad blocks, performing repairs interactively, and automatically answering "yes" to prompts. This command can help maintain the integrity of the file system and identify any potential disk issues.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the e2fsck tool