• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

fsck Command Examples in Linux

by admin

The fsck command is used to check the integrity of a file system. File system integrity refers to the correctness and validity of a file system. Most systems automatically run the fsck command at boot time so that errors, if any, are detected and corrected before the system is used. File system errors are usually caused by power failures, hardware failures, or improper shutdown of the system.

You should unmount the file system before scanning it with fsck to prevent damage to the file system.

Syntax

The syntax of the fsck command is:

# fsck [options] {device/file system name}

Repair file systems

You can use the fsck -r {device/file system name} command to repair a file system. The command will prompt you to confirm your actions. If you are simultaneously checking multiple file systems, you should not use this option because it allows you to repair only a single file system at a time.

Checking the integrity of a file system.

fsck command examples in Linux

fsck Command Examples

1. To check a file system:

# fsck /dev/sde
# fsck /mike 

2. To run the fsck in serialization mode:

# fsck -s /dev/sde 

3. To run the fsck with specifying the type of file system:

# fsck -t ext3 /mike 

4. To run fsck for all the mentioned file systems in fstab:

# fsck -A 

5. To have the progress bar while fsck iin run:

# fsck -C /dev/sde 

6. To skip running fsck on mounted file systems:

# fsck -M 

7. To dry run the fsck, just show what it would do:

# fsck -N 

8. To skip the root file system if it mounted in read-write mode:

# fsck -R

9. To skip showing title:

# fsck -T 

10. To run the fsck in verbose mode:

# fsck -V /dev/sde 

11. To automatically repair the file system, without ant skipping any questions:

# fsck -a /dev/sde 

12. Only print the problems and not to repair them:

# fsck -n /dev/sde 

13. To interactively repair the file systems:

# fsck -r /dev/sde 

14. To set the answer to “yes”:

# fsck -y /dev/sde 

Filed Under: Linux

Some more articles you might also be interested in …

  1. RHEL 7 – RHCSA Notes : Create hard and soft links.
  2. System Log File /var/log/messages Is Getting Deleted or Trimmed Automatically (CentOS/RHEL)
  3. “docker dead but subsys locked” – error while starting docker
  4. How to Change Default Port of Apache On RHEL/CentOS 7
  5. Understanding The /etc/sysconfig Directory
  6. How to show line numbers in Gedit
  7. How to install zip/unzip package in Linux CentOS/RHEL 7 and 8
  8. Basics of Ethernet Bonding in Linux
  9. How To Customize The Screensaver Options In Gnome on CentOS/RHEL 7
  10. How to Enable FTP in CentOS/RHEL 5 and 6

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright