Linux: Check for File System issues

Linux has a command called tune2fs to check and configure File Systems, the option -l does list all the values of the File Sytem related parameters.

To avoid issues with File Systems you can read out the value of  Filesystem state , when it states clean all is ok but any other output needs action.

To loop throug a list of File Systems that are part of a rootvg (LVM) below 1 liner can be used, also you can put it in a script and let cron have it run at regular intervals.

server001:~ # for i in $(df -h | grep rootvg | awk -F’ ‘ ‘{print $1}’); do tune2fs -l $i | grep state | tr -d ‘\012’; echo  ” *** $i”; done

Filesystem state:         clean *** /dev/mapper/rootvg-lvroot
Filesystem state:         clean *** /dev/mapper/rootvg-lvUC4
Filesystem state:         clean *** /dev/mapper/rootvg-lvhome
Filesystem state:         clean *** /dev/mapper/rootvg-lvopt
Filesystem state:         clean *** /dev/mapper/rootvg-lvrwe
Filesystem state:         clean *** /dev/mapper/rootvg-lvtmp
Filesystem state:         clean *** /dev/mapper/rootvg-lvusr
Filesystem state:         clean *** /dev/mapper/rootvg-lvbmc
Filesystem state:         clean *** /dev/mapper/rootvg-lvsba
Filesystem state:         clean *** /dev/mapper/rootvg-lvvar
Filesystem state:         clean *** /dev/mapper/rootvg-lvhpsum
Filesystem state:         clean *** /dev/mapper/rootvg-lvsupconf
Filesystem state:         clean *** /dev/mapper/rootvg-lvtad4d
Filesystem state:         clean *** /dev/mapper/rootvg-lvtivcit
Filesystem state:         clean *** /dev/mapper/rootvg-lvcore
Filesystem state:         clean *** /dev/mapper/rootvg-lvoracle
Filesystem state:         clean *** /dev/mapper/rootvg-lvhostctrl
Filesystem state:         clean *** /dev/mapper/rootvg-lvsmd
Filesystem state:         clean *** /dev/mapper/rootvg-lvoraclient

Sources:

http://stackoverflow.com/questions/8299553/how-to-get-the-first-column-of-comm-output

How to set up automatic filesystem checks and repair on Linux

http://stackoverflow.com/questions/11193466/echo-without-newline-in-a-shell-script