LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-22-2009, 10:07 AM   #1
bbolin
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Rep: Reputation: 0
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.

Any input would be appreciated.

Thanks
 
Old 09-22-2009, 04:59 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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:
Code:
grub> root (hd1,0)
grub> kernel /boot/vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ rhgb quiet
grub> initrd /boot/initrd-2.6.9-42.0.10.ELsmp.img
grub> boot
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.

Last edited by theNbomr; 09-22-2009 at 05:03 PM.
 
Old 09-22-2009, 05:28 PM   #3
btncix
Member
 
Registered: Aug 2009
Location: USA
Posts: 141

Rep: Reputation: 26
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.
 
Old 09-22-2009, 06:11 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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:
Code:
grub> root (hd1)
grub> map (hd1) (hd0)
grub> chainload +1
grub> boot
A menu could expand on this method ad nauseum.

--- rod.
 
Old 09-22-2009, 06:25 PM   #5
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Jus t put Plop bootmanager on your hd and it'll boot usb, usb-cd etc flawlessly

here, I have plpbt which is plop
get it HERE

and edit your hd menu.lst for plop

Code:
title Plop bootmanager
root (hd?,?)
kernel /boot/plpbt
works great on all my no-boot-from-usb computers

NOTE: usb should always be setup as (hd0,0)
menaing edit menu.lst on usb as 1st hd
 
Old 09-23-2009, 07:16 AM   #6
bbolin
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
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:
Code:
grub> root (hd1,0)
grub> kernel /boot/vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ rhgb quiet
grub> initrd /boot/initrd-2.6.9-42.0.10.ELsmp.img
grub> boot
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...).
 
Old 09-23-2009, 09:58 AM   #7
btncix
Member
 
Registered: Aug 2009
Location: USA
Posts: 141

Rep: Reputation: 26
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
 
Old 09-23-2009, 01:19 PM   #8
bbolin
LQ Newbie
 
Registered: Jun 2006
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by btncix View Post
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 /
 
  


Reply

Tags
boot, grub



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have external eSATA drive auto mount on plug-in?? colbert Linux - Hardware 14 01-19-2009 11:25 AM
Problem with esata pci card and external drive dollface Linux - Newbie 2 01-02-2009 12:18 AM
configuring eSata PCI card and Lacie 2big Dual external hard drive Flailing_Novice Linux - Hardware 18 04-17-2008 01:08 PM
Problem booting udev-based distros on external hard drive mcphail Linux - General 1 09-02-2005 09:58 PM
boot problem from external drive & SD-card booting Nightfrost Linux - Newbie 1 07-12-2004 04:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration