Pagine

Linux - FSCHK how to use and how to save your data disk

This article explains 10 practical examples on how to execute fsck command to troubleshoot and fix any filesystem errors.

Here's the tutorial:

Now you can find some command:

1. To view Mounted partition:

parted /dev/sda 'print'
 
To check a partition:
 
fsck /dev/sda6 


The following are the possible exit codes for fsck command.
  • 0 – No errors
  • 1 – Filesystem errors corrected
  • 2 – System should be rebooted
  • 4 – Filesystem errors left uncorrected
  • 8 – Operational error
  • 16 – Usage or syntax error
  • 32 – Fsck canceled by user request
  • 128 – Shared-library error
2. To check all Mounted Partition: (inside /etc/fstab)

fsck -A
 
It is recommended that you exclude the root filesystem 
during this global check by adding -R option as shown below. 
 
 # fsck -AR -y
 
3. Don't use Fstab on filesystem mounted  (like vfat) - M
 
 # mount | grep "/dev/sd*" (to view partition mounted)
 
so the command of point 2. become:
 
 # fsck -ARM -y 

4. Force a Filesystem Check Even if it’s Clean using Option -f

 # fsck -ARM -y  /dev/sda6 -f
 
5. Attempt to Fix Detected Problems Automatically using Option -y
 
 # fsck -y /dev/sda6 
 
 6. Avoid Repair, but Report Problems to Stdout using Option -n
 
 # fsck -n /dev/sda6 

7. Automatically Repair the Damaged Portions using Option -a

 # fsck -a -AR
 
For more details take a look to original article:
 
http://www.thegeekstuff.com/2012/08/fsck-command-examples/?goback=.gde_84337_member_5819204731259625476#!