Booting from CD to boot Linux distros on external esata drive
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Booting from CD to boot Linux distros on external esata drive
Hello All,
Recently purchased an external USB2.0/Esata 1TB drive. Have installed a number of distros on it and works just fine.
The only way to get them to boot is from a bootcd that I created. Here is an example of the menu.lst
default 0
timeout 10
title Windows Vista (loader)
rootnoverify (hd0)
chainloader +1
title Ubuntu 9.04, kernel 2.6.28-15-generic
kernel /boot/ubuntu.x86_64/vmlinuz-2.6.28-15-generic root=/dev/sdb5
initrd /boot/ubuntu.x86_64/initrd.img-2.6.28-15-generic
title Linux Mint 7 Gloria, kernel 2.6.28-11-generic
kernel /boot/linux_mint/vmlinuz-2.6.28-11-generic root=/dev/sdb7
initrd /boot/linux_mint/initrd.img-2.6.28-11-generic
title MEPIS kernel 2.6.27-1-mepis64-smp
kernel /boot/mepis/vmlinuz-2.6.27-1-mepis64-smp root=/dev/sdb8
initrd /boot/mepis/initrd.img-2.6.27-1-mepis64-smp
As you can see I have created directories for the specific distro I'm trying to boot. With the kernels and initrd images the CD is now about 34MB
I have been thinking about removing the recovery partition for Vista on my HP Pavilion DV5 laptop(current device using the external esata).
And installing a Linux distro to this partition. It's small only about 11GB, but it would get me away from having to use a boot CD to access the other boot systems. And simply edit the boot options on the hard drive for any addition installations or modifications.
Here is my real question -
The reason I have to use the boot CD is because the bios does not recognize the external esata hard drive. The kernel is smart enough to be able to install it to an external drive, but the bios isn't.
When I create my boot CD I have been including kernels and initrd images for each system.
Isn't there a way to boot a generic kernel(2.6) and have that kernel just do some kind of chain loading for the other systems?
Somehow just set the "root" option and go from there since at that point the external device is recognized.
This is the domain of a bootloader. You do not need to boot a kernel in order to load another kernel. Not sure that is even possible, and almost for sure not without writing a kernel module to do so.
You can boot existing on-disk kernels from the grub bootloader. For example, I have a distro installed on the only SATA drive with the kernel image and initrd image in the usual /boot location. Using a USB flash drive with grub installed (or CD in your case), I can get a grub prompt. From there, I can boot a kernel from the hard-drive with the following commands:
Note that when grub loads from the USB flash drive, it see the spinning hard disk as (hd1), and the flash drive as (hd0). To find the kernel and initrd commandlines that are appropriate, we can view what the distro installer chose, by displaying the grub.conf (or menu.lst, if your system uses that):
Code:
grub> root (hd1,0)
grub> cat /grub/grub.conf
Doing this allows you copy the appropriate commands at the grub prompt. Ultimately, you would put the commands into a grub config file.
For your purposes, you only need to create a tiny partition to hold grub and a grub config file. It needs to be made bootable, but doesn't need to hold the kernels or initrd images. You certainly don't need to install a complete distro onto it.
It is curious to me that your stanza for loading Windows says to use (hd0), which I would expect to be assigned to the boot media, which is your CD, and not either the external or internal hard disks.
--- rod.
EDIT: The above scheme will fail if the partition containing the kernels and initrd's does not contain a filesystem type that grub knows about. In other words, no LVM partitions for the partition holding the kernels and intrd's.
Since the bios does not recognize the esata drive, I think the kernel and initrd files need to reside in the internal 11 GB partition (someone else check me on this).
Obviously, the partition doesn't need to be 11 GB, but you know what I mean.
I don't know if the BIOS needs to be able to identify it, as much as grub needs to. Easy enough to find out, though. Boot to a grub prompt, then
Code:
root (hd2)
Use the appropriate drive number, probably 2, since the CD would be 0, and the internal hard-drive would be 1. If grub doesn't complain that the drive doesn't exist, then you should be able to boot from it. If grub can't work with it, then you are probably right; the boot partition (only) will have to be on the internal drive. Still, a quite small partition should suffice.
Further to my earlier post, you can also chainload grub from grub. If you have multiple /boot partitions managed by multiple distros, for instance, you may wish to boot each distro from one bootable partition, and use a 'master' grub that loads from the MBR to select a distro. You would get two levels of grub menus, but each distro would be happy installing kernel updates and so on without interference from other distros. Chainloading from one grub to another has some good examples.
Using my previous case, I can chainload the grub installed on the hard-disk MBR:
This is the domain of a bootloader. You do not need to boot a kernel in order to load another kernel. Not sure that is even possible, and almost for sure not without writing a kernel module to do so.
You can boot existing on-disk kernels from the grub bootloader. For example, I have a distro installed on the only SATA drive with the kernel image and initrd image in the usual /boot location. Using a USB flash drive with grub installed (or CD in your case), I can get a grub prompt. From there, I can boot a kernel from the hard-drive with the following commands:
Note that when grub loads from the USB flash drive, it see the spinning hard disk as (hd1), and the flash drive as (hd0). To find the kernel and initrd commandlines that are appropriate, we can view what the distro installer chose, by displaying the grub.conf (or menu.lst, if your system uses that):
Code:
grub> root (hd1,0)
grub> cat /grub/grub.conf
Doing this allows you copy the appropriate commands at the grub prompt. Ultimately, you would put the commands into a grub config file.
For your purposes, you only need to create a tiny partition to hold grub and a grub config file. It needs to be made bootable, but doesn't need to hold the kernels or initrd images. You certainly don't need to install a complete distro onto it.
It is curious to me that your stanza for loading Windows says to use (hd0), which I would expect to be assigned to the boot media, which is your CD, and not either the external or internal hard disks.
--- rod.
EDIT: The above scheme will fail if the partition containing the kernels and initrd's does not contain a filesystem type that grub knows about. In other words, no LVM partitions for the partition holding the kernels and intrd's.
Thanks for your reply -
Did a bit of tinkering this AM. When I "c" from the grub menu I can set different "root" options.
find /boot/[TAB] shows me the directories and files on the CD.
root (cd) is the CD (believe this is default for El torito if not given)
root (hd0) is the primary internal drive (not mountable ntfs)
root (hd1) error 21 disk not found
root (hd2) error 21 disk not found
So what I'm saying is if the bios does NOT give the option to boot or other reasons, the external esata drive is not available.
The only way to get there is to boot a kernel. Now just for testing this morning I removed the initrd entry for that device from the grub menu. It still boots.
You can see the kernel booting from the CD. When it see's the root entry equal to /dev/sdb5 which is valid for that distro it then boots the kernel and initrd files from that partition.
If I was to shrink the existing 2nd partition on the primary drive(vista rescue) and create a ext3 filesystem it should be seeable using the current grub setup. Also I think if a distro was installed or just the /boot files that I have on the current CD, that distro and the others would be bootable. This is all questionable and I have not tested it. This gets into the double chainloading of grub.
I could test this using virtualbox(installed on vista) setup using multiple drives.
Now your going to ask me why am I doing all of this if I have virtualbox setup and the answer is hackman do...
While xen and kvm running under Linux is neat, it leaves a little to be desired specifically when trying to run a desktop. Display, mouse, full display are bad at best. Maybe great for server setup but not desktop.
Also like to blow away the speed of vista and the 3D effects when running natively(compiz etc...).
Appreciate the feedback. One thing to note. If you're able to boot the external drives without initrd.img set through grub, then it's probably because the kernel already has support for reading those kinds of external drives. It's not that the kernel recognizes its initrd.img.
In other words, doing the following will not load initrd.img:
grub> root (hd1,0)
grub> kernel /boot/vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ rhgb quiet
grub> boot
Appreciate the feedback. One thing to note. If you're able to boot the external drives without initrd.img set through grub, then it's probably because the kernel already has support for reading those kinds of external drives. It's not that the kernel recognizes its initrd.img.
In other words, doing the following will not load initrd.img:
grub> root (hd1,0)
grub> kernel /boot/vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ rhgb quiet
grub> boot
Something of interest here. The setups I'm using are not doing any LVM stuff. Just /
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.