Drives and partitions: converting from Linux to GRUB namingconvention

Angel Tsankov fn42551 at fmi.uni-sofia.bg
Wed Aug 16 14:37:53 PDT 2006


>> Can someone suggest how to convert (in a shell script) from Linux naming convention for drives and partitions (hdxy) to GRUB 
>> naming
>> convention ((hdn,m)), taking into account that, in contrast to Linux, GRUB does not consider CD-ROM drives to be hard drives? For
>> more information, refer to section 8.4 in the LFS book, version 6.1.1.
>
> Look at the shell script /usr/sbin/grub-install. Or, you can download
> the stripped down version I use in my scripts.
>
> http://www.linuxfromscratch.org/~dnicholson/grub-devices.sh
>
> Source that file, then use the convert_grub_device function:
>
> $ convert_grub_device /dev/hda2
> (hd0,1)
>
> Careful, though. I use it in scripts, so it will exit from your
> session. Maybe you'll want to change the "exit 1" to "return 1".

Unfortunately, this script uses /boot/grub/device.map, which does not exist in the LFS system. 




More information about the lfs-support mailing list