fsck Linux Command

How to check/repair file system with fsck command in Linux?

Explanation

fsck COMMAND:


fsck is the abbreviation of "file system consistency check". This command is used to check the consistency, and it also used to repair the linux file system.

SYNTAX :


fsck [-t fs-optlist] [filesystem] [fs-specific-options]

OPTIONS:


OptionsDescriptions
-F identifies the file system type (type).
-V echoes the completed command line.(verbose).
-m Makes the initial file check. Returns any of the code, based on the state of the file system. 0 - "clean", 32 - "dirty".
-y or -Y or -n or -N To autorun commands by answering yes or no to all the prompts.
c This option is used to convert the previously static allocated tables into new dynamic allocated tables of old pre- SunOS 4.1 file system.
w Permit access only for the file system that have access to write.
special Specifies the mount point or raw device name of one or more file systems.
p runs the command and repairs the files automatically in the silent mode, stops unless the file has some problem due any intervention. This option also enables parallel checking of UFS file systems.
b=blocknumber repairs the bad superblock
Example 1
fsck /dev/sda1

This command will check the device /dev/sda1 to find any errors.
Example 2
fsck -y /dev/sda1

Here, -y option check /dev/sda1 and runs the command automatically to fix any errors found.

Ask Questions

Ask Question