commit ef471478e4b8950a3312ffc736113f9b9e8946f2 Author: Mike Hiretsky Date: Tue Jul 26 18:20:55 2011 +0400 Fix detect filesystem for lvm. Fix readable_by_grub, prepare_grub_access_device for LVM. Fix grub-install. Sometimes program cann't determine fs for device by path /dev/mapper. For resolve the problem filesystem for that devices determined by device to which they point. (readlink -f) diff --git util/grub-install.in util/grub-install.in index 16236ba..8cf86be 100644 --- util/grub-install.in +++ util/grub-install.in @@ -465,6 +465,11 @@ fi # Create the core image. First, auto-detect the filesystem module. fs_module="`"$grub_probe" --device-map="${device_map}" --target=fs --device "${grub_device}"`" +# sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X +if test "x$fs_module" = x ; then + grub_device_fs=$(readlink -f ${grub_device}) + fs_module="`"$grub_probe" --device-map="${device_map}" --target=fs --device "${grub_device_fs}"`" +fi if test "x$fs_module" = x ; then echo "Auto-detection of a filesystem of ${grub_device} failed." 1>&2 echo "Try with --recheck." 1>&2 diff --git util/grub-mkconfig_lib.in util/grub-mkconfig_lib.in index 2c5fd8c..a2dcd20 100644 --- util/grub-mkconfig_lib.in +++ util/grub-mkconfig_lib.in @@ -58,7 +58,11 @@ is_path_readable_by_grub () # abort if file is in a filesystem we can't read if "${grub_probe}" -t fs "$path" > /dev/null 2>&1 ; then : ; else - return 1 + # sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X + fsdevice=`readlink -f $(${grub_probe} -t device "$path" 2>/dev/null)` + if "${grub_probe}" -t fs -d "${fsdevice}" > /dev/null 2>&1 ; then : ; else + return 1 + fi fi # ... or if we can't figure out the abstraction module, for example if @@ -121,7 +125,13 @@ prepare_grub_to_access_device () esac done - fs="`"${grub_probe}" --device "${device}" --target=fs`" + # sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X + if "${grub_probe}" --device "${device}" --target=fs >/dev/null 2>/dev/null; then + device_fs="${device}" + else + device_fs=`readlink -f "${device}"` + fi + fs="`"${grub_probe}" --device "${device_fs}" --target=fs`" for module in ${fs} ; do echo "insmod ${module}" done