Forrest logo
back to the fsck tool

fsck:tldr:08d2c

fsck: Check filesystem `/dev/sdX` only if it is clean, reporting any damaged blocks and automatically repairing them.
$ fsck -fy ${-dev-sdX}
try on your machine

The command fsck -fy ${-dev-sdX} is used to run a file system check on a specific disk drive, denoted as /dev/sdX. Here's an explanation of each component:

  • fsck: Stands for "file system consistency check." It is a command-line utility used to verify and repair issues with a file system. It is typically used when a file system is suspected to be corrupted or has errors.

  • -fy: These are options passed to the fsck command.

    • The -f option stands for "force" and is used to force a file system check even if the system deems it unnecessary.
    • The -y option stands for "yes" and prompts the command to automatically respond "yes" to any prompts for fixing errors.
  • ${-dev-sdX}: This is a placeholder that represents the device name of the disk or partition you want to check. The actual device name would replace ${-dev-sdX} in the command. For example, if you want to check /dev/sdb1, the command would be fsck -fy /dev/sdb1. Make sure to specify the correct device name when using this command.

Overall, the command fsck -fy ${-dev-sdX} forcefully performs a file system check on the specified disk drive, automatically fixing any encountered errors without prompting for confirmation.

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 fsck tool