Skip to content

Instantly share code, notes, and snippets.

@rlaager
Created January 16, 2012 04:39
Show Gist options
  • Save rlaager/1619096 to your computer and use it in GitHub Desktop.
Save rlaager/1619096 to your computer and use it in GitHub Desktop.
zfs-initramfs-slow-drives
--- zfs-linux-0.6.0.44/debian/tree/usr/share/initramfs-tools/scripts/zfs 2011-01-12 19:30:38.000000000 -0600
+++ zfs-linux-0.6.0.44/debian/tree/usr/share/initramfs-tools/scripts/zfs 2012-01-15 18:34:53.985778000 -0600
@@ -64,15 +64,22 @@
# environment and doing a full import in the regular system instead.
[ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool $ZFS_RPOOL"
- if [ -f /etc/zfs/zpool.cache ]
- then
- ZFS_STDERR=$(zpool list "$ZFS_RPOOL" 1>/dev/null 2>&1 \
- || zpool import -f -N "$ZFS_RPOOL" 2>&1)
- ZFS_ERROR=$?
- else
- ZFS_STDERR=$(zpool import -f -N "$ZFS_RPOOL" 2>&1)
- ZFS_ERROR=$?
- fi
+ ZPOOL_TIMEOUT=10
+ while [ 1 ] ; do
+ if [ -f /etc/zfs/zpool.cache ]
+ then
+ ZFS_STDERR=$(zpool list "$ZFS_RPOOL" 1>/dev/null 2>&1 \
+ || zpool import -f -N "$ZFS_RPOOL" 2>&1)
+ ZFS_ERROR=$?
+ else
+ ZFS_STDERR=$(zpool import -f -N "$ZFS_RPOOL" 2>&1)
+ ZFS_ERROR=$?
+ fi
+ [ "$ZFS_ERROR" -eq 0 ] && break
+ ZPOOL_TIMEOUT=$(($ZPOOL_TIMEOUT - 1))
+ [ "$ZPOOL_TIMEOUT" -gt 0 ] || break
+ sleep 1
+ done
[ "$quiet" != "y" ] && log_end_msg
if [ "$ZFS_ERROR" -ne 0 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment