* 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/branches/fix-style/; revision=14175
This commit is contained in:
parent
09bcf1418c
commit
ad36ce1f5b
@ -140,7 +140,7 @@ if test -n "$debug1devices"; then fail; fi
|
|||||||
|
|
||||||
# Return true if the machine is on AC power, or if we can't determine
|
# Return true if the machine is on AC power, or if we can't determine
|
||||||
# whether it's on AC power.
|
# whether it's on AC power.
|
||||||
onACPower () {
|
onACPower() {
|
||||||
if test -d "/proc/acpi/battery"; then
|
if test -d "/proc/acpi/battery"; then
|
||||||
if ls /proc/acpi/battery/BAT[0-9]* > /dev/null 2>&1; then
|
if ls /proc/acpi/battery/BAT[0-9]* > /dev/null 2>&1; then
|
||||||
if cat /proc/acpi/battery/BAT*/state \
|
if cat /proc/acpi/battery/BAT*/state \
|
||||||
@ -158,27 +158,28 @@ onACPower () {
|
|||||||
fi
|
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 .
|
# Check the specified file system, if appropriate.
|
||||||
mustCheck=
|
checkFS() {
|
||||||
if test -b "$device"; then
|
# Only check block devices.
|
||||||
mustCheck=1
|
if ! test -b "$device"; then return 0; fi
|
||||||
else
|
|
||||||
case $device in
|
# For unclean ext3 file systems, fsck.ext3 should just replay the
|
||||||
LABEL=*)
|
# journal and exit, but in practice this takes *much* longer than
|
||||||
mustCheck=1
|
# letting the kernel recover the FS. So, don't run fsck on
|
||||||
;;
|
# journalling file systems.
|
||||||
esac
|
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
|
fi
|
||||||
|
|
||||||
if test -n "$mustCheck"; then
|
|
||||||
if onACPower; then
|
|
||||||
FSTAB_FILE="/etc/mtab" fsck -V -v -C -a "$device"
|
FSTAB_FILE="/etc/mtab" fsck -V -v -C -a "$device"
|
||||||
fsckResult=$?
|
fsckResult=$?
|
||||||
|
|
||||||
@ -197,11 +198,19 @@ mountFS() {
|
|||||||
echo "fsck on $device failed."
|
echo "fsck on $device failed."
|
||||||
fail
|
fail
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# Don't run `fsck' if the machine is on battery power.
|
return 0
|
||||||
echo "on battery power, so \`fsck' not run on \`$device'"
|
}
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
# 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 read-writable.
|
||||||
mount -t "$fsType" -o "$options" "$device" /mnt-root$mountPoint || fail
|
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
|
# !!! Really quick hack to support bind mounts, i.e., where the
|
||||||
# "device" should be taken relative to /mnt-root, not /. Assume
|
# "device" should be taken relative to /mnt-root, not /. Assume
|
||||||
# that every device that start with / but doesn't start with /dev
|
# that every device that starts with / but doesn't start with /dev
|
||||||
# or LABEL= is a bind mount.
|
# is a bind mount.
|
||||||
case $device in
|
case $device in
|
||||||
/dev/*)
|
/dev/*)
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user