#!/bin/bash # checkfs # Source functions library source /etc/rc.d/init.d/functions # Printing the script name in the init log file log_script_name "$0 $*" # If the /fastboot file exists we don't want to run the partition checks if [ -f /fastboot ]; then msg_box_nolog "Fast boot mode (no file systems check)" FSCK_RETURN_CODE=$EXIT_CODE_SUCCESS else # Mount the root partition read-only (just in case the kernel mounts it # read-write and we don't want to run fsck on a read-write mounted # partition). cmd_run_log /bin/mount -o remount,ro / if [ $? = 0 ]; then # Check all the file systems mentioned in /etc/fstab that have the # fs_passno value set to 1 or 2 (the 6th field. See man fstab for more # info). cmd_run_log_box_warn_checkfs "Checking file systems" /sbin/fsck -a -A -C -T FSCK_RETURN_CODE=$? if [ ${FSCK_RETURN_CODE} -eq ${EXIT_CODE_FAILURE} ]; then # Start sulogin so we can repair the damage manually. boot_failure "FAILURE: fsck failed. Try running fsck without the -a option." fi else # If the remount to read-only mode didn't work abort the fsck and print # an error. echo "Cannot check root file system because it could not be mounted" echo "in read-only mode." FSCK_RETURN_CODE=$EXIT_CODE_FAILURE fi fi exit ${FSCK_RETURN_CODE}