* Remove the sleep-5-seconds hack in the initrd, instead loop until
the device to mount appears. This wasn't previously possible because of root devices specified by label (mounted via "mount LABEL=foo ..."), but now we use /dev/disk/by-label so we can easily test whether the device already exists. svn path=/nixos/trunk/; revision=12562
This commit is contained in:
parent
a83becdee8
commit
2783f96ce7
|
@ -155,10 +155,6 @@ mountFS() {
|
||||||
# Try to find and mount the root device.
|
# Try to find and mount the root device.
|
||||||
mkdir /mnt-root
|
mkdir /mnt-root
|
||||||
|
|
||||||
echo "mounting the root device.... (fix: sleeping 5 seconds to wait for upcoming usb drivers)"
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Hard-coded root device(s).
|
|
||||||
mountPoints=(@mountPoints@)
|
mountPoints=(@mountPoints@)
|
||||||
devices=(@devices@)
|
devices=(@devices@)
|
||||||
fsTypes=(@fsTypes@)
|
fsTypes=(@fsTypes@)
|
||||||
|
@ -182,6 +178,22 @@ for ((n = 0; n < ${#mountPoints[*]}; n++)); do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# USB storage devices tend to appear with some delay. It would be
|
||||||
|
# great if we had a way to synchronously wait for them, but
|
||||||
|
# alas... So just wait for a few seconds for the device to
|
||||||
|
# appear. If it doesn't appear, try to mount it anyway (and
|
||||||
|
# probably fail). This is a fallback for non-device "devices"
|
||||||
|
# that we don't properly recognise (like NFS mounts).
|
||||||
|
if ! test -e $device; then
|
||||||
|
echo -n "waiting for device $device to appear..."
|
||||||
|
for ((try = 0; try < 10; try++)); do
|
||||||
|
sleep 1
|
||||||
|
if test -e $device; then break; fi
|
||||||
|
echo -n "."
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
echo "mounting $device on $mountPoint..."
|
echo "mounting $device on $mountPoint..."
|
||||||
|
|
||||||
mountFS "$device" "$mountPoint" "$options" "$fsType"
|
mountFS "$device" "$mountPoint" "$options" "$fsType"
|
||||||
|
|
Loading…
Reference in New Issue