* Don't run fsck on journalling file systems. Instead assume
that the file system driver will replay the journal at mount-time in case of an unclean shutdown. For ext3 at least this is *much* faster. svn path=/nixos/trunk/; revision=13932
This commit is contained in:
parent
d98f482739
commit
aff7fba098
|
@ -158,27 +158,28 @@ onACPower () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Function for mounting a file system.
|
||||
mountFS() {
|
||||
local device="$1"
|
||||
local mountPoint="$2"
|
||||
local options="$3"
|
||||
local fsType="$4"
|
||||
|
||||
# Check the root device, if .
|
||||
mustCheck=
|
||||
if test -b "$device"; then
|
||||
mustCheck=1
|
||||
else
|
||||
case $device in
|
||||
LABEL=*)
|
||||
mustCheck=1
|
||||
;;
|
||||
esac
|
||||
# Check the specified file system, if appropriate.
|
||||
checkFS() {
|
||||
# Only check block devices.
|
||||
if ! test -b "$device"; then return 0; fi
|
||||
|
||||
# For unclean ext3 file systems, fsck.ext3 should just replay the
|
||||
# journal and exit, but in practice this takes *much* longer than
|
||||
# letting the kernel recover the FS. So, don't run fsck on
|
||||
# journalling file systems.
|
||||
eval $(fstype "$device")
|
||||
if test "$FSTYPE" = ext3 -o "$FSTYPE" = ext4 -o "$FSTYPE" = reiserfs -o "$FSTYPE" = xfs -o "$FSTYPE" = jfs; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
# Don't run `fsck' if the machine is on battery power. !!! Is
|
||||
# this a good idea?
|
||||
if ! onACPower; then
|
||||
echo "on battery power, so \`fsck' not run on \`$device'"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if test -n "$mustCheck"; then
|
||||
if onACPower; then
|
||||
FSTAB_FILE="/etc/mtab" fsck -V -v -C -a "$device"
|
||||
fsckResult=$?
|
||||
|
||||
|
@ -197,11 +198,19 @@ mountFS() {
|
|||
echo "fsck on $device failed."
|
||||
fail
|
||||
fi
|
||||
else
|
||||
# Don't run `fsck' if the machine is on battery power.
|
||||
echo "on battery power, so \`fsck' not run on \`$device'"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Function for mounting a file system.
|
||||
mountFS() {
|
||||
local device="$1"
|
||||
local mountPoint="$2"
|
||||
local options="$3"
|
||||
local fsType="$4"
|
||||
|
||||
checkFS "$device"
|
||||
|
||||
# Mount read-writable.
|
||||
mount -t "$fsType" -o "$options" "$device" /mnt-root$mountPoint || fail
|
||||
|
@ -224,8 +233,8 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do
|
|||
|
||||
# !!! Really quick hack to support bind mounts, i.e., where the
|
||||
# "device" should be taken relative to /mnt-root, not /. Assume
|
||||
# that every device that start with / but doesn't start with /dev
|
||||
# or LABEL= is a bind mount.
|
||||
# that every device that starts with / but doesn't start with /dev
|
||||
# is a bind mount.
|
||||
case $device in
|
||||
/dev/*)
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue