fsck - Unix, Linux Command

fsck - check and repair a Linux file system
fsck [-sAVRTMNP] [-C [fd]] [-t fstype] [filesys...] [--] [fs-specific-options]
Example-1:
To Filesystem Check on a Disk Partition:
# fsck /dev/sda6
output:
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
/dev/sda6: clean, 95/2240224 files, 3793506/4476416 blocks
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
/dev/sda6: clean, 95/2240224 files, 3793506/4476416 blocks
dosfsck 3.0.12, 29 Oct 2011, FAT32, LFN
/dev/sda7: 8 files, 50/1463400 clusters
output:
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)/dev/sda6: clean, 11/2240224 files, 70327/4476416 blocks
Example-4:
Don’t execute Fsck on Mounted Filesystem using Option -M
# mount | grep "/dev/sd*"
/dev/sda5 on / type ext4 (rw,errors=remount-ro)
/dev/sda6 on /mydata type ext2 (rw)
/dev/sda7 on /backup type vfat (rw)

# fsck -M /dev/sda7  (note: fsck will simply exit with the exit code 0)output:
# echo $?
0
Example-5:
Skip the Display Title using Option -T
# fsck -TAR
output:
e2fsck 1.42.9 (4-Feb-2014)/dev/sda6: clean, 11/2240224 files, 70327/4476416 blocks
Force a Filesystem Check Even if it’s Clean using Option -f
# fsck /dev/sda6
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014) /dev/sda6: clean, 95/2240224 files, 3793503/4476416 blocks # fsck /dev/sda6 -foutput:
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda6: 95/2240224 files (7.4% non-contiguous), 3793503/4476416 blocks
Example-7:
Attempt to Fix Detected Problems Automatically using Option -y
# fsck -y /dev/sda6
output:fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 2060353 is a unknown file type with mode 0137642 but it looks 
like it is really a directory.
Fix? yes

Pass 2: Checking directory structure
Entry 'test' in / (2) has deleted/unused inode 49059.  Clear? yes

Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/sda6: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda6: 96/2240224 files (7.3% non-contiguous), 3793508/4476416 blocks
output:
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 2060353 is a unknown file type with mode 0173 but it looks 
like it is really a directory.
Fix? no
Inode 2060353, i_blocks is 8, should be 0.  Fix? no

Pass 2: Checking directory structure
Inode 2060353 (/Movies) has invalid mode (0173).
Clear? no

Inode 49057 (/fwh) has invalid mode (013).
Clear? no

Entry 'fwh' in / (2) has an incorrect filetype (was 1, should be 0).
Fix? no

Pass 3: Checking directory connectivity
Unconnected directory inode 65409 (???)
Connect to /lost+found? no

'..' in ... (65409) is ??? (2060353), should be  (0).
Fix? no

Unconnected directory inode 2076736 (???)
Connect to /lost+found? no

Pass 4: Checking reference counts
Inode 2 ref count is 4, should be 3.  Fix? no

Inode 65409 ref count is 3, should be 2.  Fix? no

Inode 2060353 ref count is 16, should be 15.  Fix? no

Unattached inode 2060354
Connect to /lost+found? no

Pass 5: Checking group summary information
Block bitmap differences:  -(164356--164357) -4149248
Fix? no

Directories count wrong for group #126 (1, counted=0).
Fix? no

/dev/sda6: ********** WARNING: Filesystem still has errors **********

/dev/sda6: 96/2240224 files (7.3% non-contiguous), 3793508/4476416 blocks

    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page