Advertisement
xe1phix

Xe1phix-[Fsck]-Cheatsheet-[v4.5.92].sh

Oct 7th, 2022
1,014
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.10 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ## ----------------------------------------------------------------------------------------------------- ##
  4.     fsck -N                     ## dont execute, just show what could be done
  5.     fsck -As                    ## Check and repair all filesystems listed in /etc/fstab
  6.     fsck -f /dev/sda1           ## Force a filesystem check on /dev/sda1
  7.     fsck -fv /dev/sda1          ## Force another check, this time with verbose output:
  8.     fsck -y /dev/sda1           ## During filesystem repair, do not ask questions and assume yes
  9. ## ----------------------------------------------------------------------------------------------------- ##
  10.     fsck.ext2 -c /dev/sda1      ## Check a ext2 filesystem, running the badblocks command
  11.     e2fsck -c /dev/sda1         ## mark all bad blocks and add them to the bad block inode to
  12.                                 ## prevent them from being allocated to files or directories
  13. ## ----------------------------------------------------------------------------------------------------- ##
  14.     e2fsck -p                   ## Automatic repair (no questions)
  15.     e2fsck -n                   ## Make no changes to the filesystem
  16.     e2fsck -y                   ## Assume "yes" to all questions
  17.     e2fsck -c                   ## Check for bad blocks and add them to the badblock list
  18.     e2fsck -f                   ## Force checking even if filesystem is marked clean
  19.     e2fsck -v                   ## Be verbose
  20. ## ----------------------------------------------------------------------------------------------------- ##
  21.     e2fsck -b $Superblock       ## Use alternative superblock
  22.     e2fsck -B $BlockSize        ## Force blocksize when looking for superblock
  23.     e2fsck -j $Dir              ## Set location of the external journal
  24.     e2fsck -l $BadBlocksFile    ## Add to badblocks list
  25.     e2fsck -L $BadBlocksFile    ## Set badblocks list
  26. ## ----------------------------------------------------------------------------------------------------- ##
  27.     badblocks -o $BadBlocks.rpt /dev/sda3 $TotalBlockCount
  28.     e2fsck -f -l $BadBlocks.rpt /dev/sda1
  29. ## ----------------------------------------------------------------------------------------------------- ##
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement