Video Screencast Help
Search Video Help Close Back
to help

How to fsck between import and mounts

Created: 28 Nov 2012 | Updated: 04 Dec 2012 | 4 comments
sclind's picture
0 0 Votes
Login to vote
This issue has been solved. See solution.

Is there a way to define that an fsck command needs to be run on each file system between the time the dg is imported and the file systems are actually mounted?  In case we have an abnormal shutdown we'd like to make sure we check the file systems for errors. 

Comments 4 CommentsJump to latest comment

mikebounds's picture

The mount agent does an fsck if required - see extract from bundled agent guide for FsckOpt attribute:

 

Use this attribute to specify options for the fsck command. You
must correctly set this attribute for local mounts. If the mount
process fails, the fsck command is executed with the specified
options before it attempts to remount the block device. Its value
must include either -y or -n. Refer to the fsck manual page for more
information.
 
If want to force a fsck before the first mount is tried, you would have to create a custom resource.  For exampe, create the following file called fsck.sh in /opt/VRTSvcs/bin:
BLOCK_DEVICE=$2
LOCKFILE=/tmp/.{$3}.DO_NOT_REMOVE
case "$1" in
start)
    touch $LOCKFILE
    fsck $BLOCK_DEVICE;;
stop)
    rm $LOCKFILE
    ;;
monitor)
if [ -a $LOCKFILE ]
then
        exit 110
    else
        exit 100
    fi ;;
*) 
    echo "Usage: $0 {start|stop|monitor} block_device lock_file
    exit 1
    ;;
esac 
 

Then create a resource using Application agent like:

Application fsk_vol1 (
  StartProgram = "/opt/VRTSvcs/bin/fsck.sh start /dev/vx/dsk/mydg/vol1 vol1"
  StopProgram = "/opt/VRTSvcs/bin/fsck.sh stop /dev/vx/dsk/mydg/vol1 vol1"
  MonitorProgram = "/opt/VRTSvcs/bin/fsck.sh monitor /dev/vx/dsk/mydg/vol1 vol1"
)

and make this resource dependent on diskgroup resource and make associated mount point dependent on this application resource

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has helped you, please vote or mark as solution

SOLUTION
+1
Login to vote
  • Actions
sclind's picture

Mike - now in see (in some doc provided by the consultant that set this all up) that fskcopt is defined:

hares -modify <resource_name> FsckOpt %-y

But I've never seen an fsck run when the resource was started.  I know we've had some start ups after abnormal shutdowns and I would have expected to see some evidence of the fsck while the online process was running.

We do believe we have some file system corruption - which is why I ask.

Scott

0
Login to vote
  • Actions
mikebounds's picture

I believe Fsck is only run if the mount fails and if Fsck is set to "n", then if mount fails, then agent does not try an fsck.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has helped you, please vote or mark as solution

0
Login to vote
  • Actions
sclind's picture

Thanks guys.  I think we'll try to schedule some down time to run an fsck just to be sure.

0
Login to vote
  • Actions