LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-08-2010, 11:18 AM   #1
thefool
LQ Newbie
 
Registered: May 2005
Posts: 4

Rep: Reputation: 0
nstalling GRUB on a disk that is going to be actually installed on a different comput


Hello,

I hope I'm wording this issue clearly.

I'd like to plug a disk (IDE or SATA) into an adapter that lets me plug it into my workstation via USB. (E.g. http://www.newegg.com/Product/Produc...82E16817153071)

It will show up as /dev/sdX where X is some arbitrary letter depending on what other disks the system happens to have.

I'd like to have a script then partition, format and copy files onto it. Then we need to install GRUB on it.

Then I will remove the disk and install it permanently into a different computer, here it will either be /dev/hda (if IDE) or /dev/sda (if SATA).

However, it seems that in general when you install GRUB on a disk, it assumes it is going to be the same disk that boots??

I am first trying an IDE disk so it will be /dev/hda.

I get a "GRUB Hard Disk Error" when booting it as /dev/hda rather than whetever it was on the USB adapter. I used this to install grub:

grub-install --root-directory /mnt/removable/ /dev/sdX

Where X was the appropriate letter based on the USB adapter. Then I fixed /mnt/removable/boot/grub/device.map to use /dev/hda../dev/hdc instead of sda..sdc.

I haven't found much about this specific scenario I have so far on the web.

I am guessing that stage1 is either attempting to find files based on what the original workstations primary disk geometry was, or it's assuming that the disk is the same location as it was when it was a "removable" one (i.e. /dev/sdX or (hd5) or whatever, when it should just be looking at (hd0).

The goal is to do this kind of installation easily and quickly, and not have to do it individually on each final computer via install CDROM or whatever, or reboot the workstation each time in order to attach the disk as the same location there, etc. (This is a manufacturing setting).

Thanks for any ideas you have!

Reed
 
Old 10-08-2010, 11:42 AM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: /root
Distribution: Slackware & BSD
Posts: 1,206

Rep: Reputation: 230Reputation: 230Reputation: 230
Quote:
It will show up as /dev/sdX where X is some arbitrary letter depending on what other disks the system happens to have.
No, it doesn't matter at this instance because Grub is using different labels on partitions: that is, '(hd0,0)' for the first drive first partition. Check again your configuration.

Quote:
However it is most advisable to install grub on the computer that is booting it.

I get a "GRUB Hard Disk Error" when booting it as /dev/hda rather than whetever it was on the USB adapter. I used this to install grub:

grub-install --root-directory /mnt/removable/ /dev/sdX
Do not use 'grub-install' as it will merely guess the drive maps. Use the basic steps of safe commands:

Code:
grub> find /boot/grub/stage1
grub> root (hd0,x)
grub> setup (hd0,x)
grub> quit
Try if this will work when the disk is moved to another machine.

Hope it helps.
 
Old 10-08-2010, 12:52 PM   #3
thefool
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks! Won't (hd0,x) install it on partion x of my workstation's hard disk rather than the MBR of my desired disk (the removable one on the USB thing)?

Will it also work if I use, say (hd2) there? (If (hd2) is my removable disk)?

What side effect does "find" have, or is it just to determine what (hdN) identifier to use? I do want to automate this process, but I think I can convert the /dev/sdX name I get from HAL when the disk is inserted to a likely grub (hdN)...
 
Old 10-08-2010, 01:39 PM   #4
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,551

Rep: Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710Reputation: 710
root (hd0,0) This will install Grub files to the first partition of the first disk, that is if you are using Grub Legacy and not Grub2.

Quote:
Will it also work if I use, say (hd2) there? (If (hd2) is my removable disk)
If you do: root (hd2,0) it will install Grub files to the first partition of the third disk if you are using Grub Legacy.

setup (hd2) This will install Grub stage1 file to the mbr of the third disk.

The find command just tells you where whatever files you are looking for are, what disk and partition.

Grub numbers both partitions and drives beginning with zero.
Grub2 numbers drives from zero and partitions from one.
You didn't indicate which distribution you are using so...?
 
Old 10-12-2010, 04:21 PM   #5
thefool
LQ Newbie
 
Registered: May 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Yeah, it's grub 1 (Debian 5)

Quote:
Originally Posted by yancek View Post
root (hd0,0) This will install Grub files to the first partition of the first disk, that is if you are using Grub Legacy and not Grub2.



If you do: root (hd2,0) it will install Grub files to the first partition of the third disk if you are using Grub Legacy.

setup (hd2) This will install Grub stage1 file to the mbr of the third disk.

The find command just tells you where whatever files you are looking for are, what disk and partition.

Grub numbers both partitions and drives beginning with zero.
Grub2 numbers drives from zero and partitions from one.
You didn't indicate which distribution you are using so...?
 
Old 10-12-2010, 08:03 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,140

Rep: Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987Reputation: 987
All sorts of potential problems with this. Grub (classic) stage1 uses a bitmap to indicate which *BIOS* drive it needs to go talk to for post-stage1. That's effectively what you pass it in the "root (hdx,y)" directive.
The BIOS order may not (often isn't) the same as the order the udev rules and initscripts generate. So getting the two to agree from a terminal invocation is damn near impossible.

Ubuntu used to have a patched grub that would accept UUID - did Debian ever accept that ?.
 
  


Reply

Tags
boot, boot loader, disk, grub


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB Installed in a disk without windoze and trying to boot windoze in another disk caosxxi General 13 09-07-2009 03:10 PM
Fedora8 installed on Software Raid+lvm will not start (GRUB Hard Disk Error) nikaudio Fedora - Installation 1 07-08-2008 08:50 AM
nstalling a program on ubuntu hacker13pcwouster Linux - Software 6 09-20-2007 01:23 PM
Another de-Windows'd comput-er GrapefruiTgirl LinuxQuestions.org Member Intro 3 12-25-2006 11:52 PM
Does it matter what part of the disk grub is installed to if it is chainloaded to? dr_zayus69 Linux - Software 1 03-05-2005 07:07 AM


All times are GMT -5. The time now is 01:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration