How to force "FSCK" filesystem check

book

Article ID: 168068

calendar_today

Updated On:

Products

XOS

Issue/Introduction

Steps to force "FSCK" filesystem check
N/A

Cause

What is FSCK?

FSCK is a utility used to check and repair hard disk file system inconsistencies. Typical causes of hard disk inconsistencies include, but are not limited to:
  • Abnormal shutdown due to hardware failure 
  • Power failure or switching off the system without proper shutdown

Resolution

How do I force an FSCK filesystem check?

The following example shows how to force FSCK to execute against all filesystem mounts on a CPM with an IDE drive installed upon the next reboot:

1.     Identify the filesystem mounts you want to run FSCK against using "df":

[[email protected] admin]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/hda7 7.5G 1.1G 6.1G 15% /

/dev/hda1 100M 7.7M 87M 9% /boot

none 503M 0 503M 0% /dev/shm

/dev/hda6 965M 60M 856M 7% /cbconfig

/dev/hda8 26G 1.5G 23G 6% /tftpboot

localhost:/tftpboot/vsx_common

26G 1.5G 23G 6% /tftpboot/vsx_1/vsx_common

localhost:/tftpboot/vsx_common

The filesystems that we want to force a check on with FSCK upon next reboot are:

/dev/hda7

/dev/hda1

/dev/hda6

/dev/hda8

2.     Create a file named "forcefsck" at the root folder of each desired filesystem to force the check on next reboot. For example:

[[email protected] admin]# touch /forcefsck (for /dev/hda7)

[[email protected] admin]# touch /boot/forcefsck (for /dev/hda1)

[[email protected] admin]# touch /cbconfig/forcefsck (for /dev/hda6)

[[email protected] admin]# touch /tftpboot/forcefsck (for /dev/hda8)

3.     Reboot the CPM and you will notice upon reboot fsck executed via the console:

[boot sequence truncated for brevity]

........

Checking root filesystem

/dev/hda7 check forced.

/dev/hda7: 33087/1001920 files (0.2% non-contiguous), 296051/2002092 blocks

[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/hda7

[ OK ]

Remounting root filesystem in read-write mode: [ OK ]

Finding module dependencies: [ OK ]

Using /lib/modules/2.4.18-5uni/addonx/sdp2_apm84xx.o

Using /lib/modules/2.4.18-5uni/addonx/bcm5700.o

Using /lib/modules/2.4.18-5uni/addonx/cbseeprom.o

Warning: loading /lib/modules/2.4.18-5uni/addonx/cbseeprom.o will taint the kernel: non-GPL license - Crossbeam Systems, Inc.

Using /lib/modules/2.4.18-5uni/addonx/cbsmod.oWarning: loading /lib/modules/2.4.18-5uni/addonx/cbsmod.o will taint the kernel: non-GPL license - Crossbeam Systems, Inc.

Using /lib/modules/2.4.18-5uni/addonx/cbnvram.o

Warning: loading /lib/modules/2.4.18-5uni/addonx/cbnvram.o will taint the kernel: non-GPL license - Crossbeam Systems, Inc.

Using /lib/modules/2.4.18-5uni/addonx/cbsdrbd.o

Checking filesystems

/dev/hda1 has been mounted 1 times without being checked, check forced.

/dev/hda1: 38/13056 files (0.0% non-contiguous), 2374/26097 blocks

Checking all file systems.

[/sbin/fsck.ext3 (1) -- /boot] fsck.ext3 -a /dev/hda1

[ OK ]

Mounting local filesystems: [ OK ]

Enabling swap space: [ OK ]

INIT: Entering runlevel: 3

Entering non-interactive startup

---- fsck mirrored partitions

e2fsck 1.27 (8-Mar-2002)

/dev/hda6 has been mounted 1 times without being checked, check forced.

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/hda6: 2170/125696 files (3.3% non-contiguous), 19258/251007 blocks

e2fsck 1.27 (8-Mar-2002)

/dev/hda8 has been mounted 1 times without being checked, check forced.

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/hda8: 91969/3506176 files (0.1% non-contiguous), 491366/7000315 blocks

Election done... transition to PRIMARY

e2fsck 1.27 (8-Mar-2002)

/dev/hda6: clean, 2170/125696 files, 19258/251007 blocks

/bin/mount -t ext3 -o rw /dev/hda6 /cbconfig

e2fsck 1.27 (8-Mar-2002)

/dev/hda8: clean, 91969/3506176 files, 491366/7000315 blocks

........

4.     Remove each of the "forcefsck" files from each of the root directories to ensure the fsck is not forced upon the next reboot of the CPM.

Workaround

N/A