/dev/disk/by-uuid seems to be only created when the partition table gets
reread after a new filesystem has been created.
So here's a patch which does it with sfdisk.

I wasn't sure if some devices like e.g. /dev/mapper/* should be ignored.
mdraid devices can have partitions so they should be tried too.

-- 
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
2009-10-28  Felix Zielcke  <fziel...@z-51.de>

	* util/grub.d/10_linux.in: Try to reread partition table with 
	sfdisk before we check if UUIDs can be used.

Index: util/grub.d/10_linux.in
===================================================================
--- util/grub.d/10_linux.in	(revision 2668)
+++ util/grub.d/10_linux.in	(working copy)
@@ -35,6 +35,13 @@ case ${GRUB_DEVICE} in
   ;;
 esac
 
+# Try to reread partition table.  In case a fresh filesystem has been created
+# /dev/disk/by-uuid doestn't yet exist.
+if which sfdisk /dev/null ; then
+  GRUB_DEVICE_DISK=`echo ${GRUB_DEVICE} | sed -e "s/[0-9]*$//"`
+  sfdisk -R ${GRUB_DEVICE_DISK} 2>/dev/null
+fi
+
 if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
     || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
   LINUX_ROOT_DEVICE=${GRUB_DEVICE}
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to