LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-29-2011, 06:14 PM   #1
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Rep: Reputation: 37
Question GRUB config on another disk


Is it possible to install GRUB in the MBR of the only bootable disk in the system, but load configuration and images from another disk?

Basically I want to install GRUB on /dev/sda, but menu and images will be under /dev/sdb2.

Note: /dev/sdb is not bootable.

Thanks.

Last edited by designator; 04-29-2011 at 06:15 PM.
 
Old 04-29-2011, 06:33 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Yes, it is no problem to do that. Do you have any difficulties with that?
 
Old 04-29-2011, 06:39 PM   #3
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
To be honest, I have no idea how to point it to dev/sdb2.
grub-install only takes path as argument for --root-directory.

/dev/sda1 is NTFS so I thought I'll have to use GRUB4DOS.
I was a little anxious to install GRUB to /dev/sda because it would overwrite NTLDR and I don't want to have to reinstall it.

Is GRUB4DOS a better idea in my case?
Also, does regular GRUB support NTFS? (Being installed on, not booting into Windows)

Last edited by designator; 04-29-2011 at 07:03 PM.
 
Old 04-29-2011, 07:33 PM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If your /-partition from your Linux install is on /dev/sdb1, boot to a live medium and do:
Code:
mount /dev/sdb1 /mnt
Your /-partition is now mounted as /mnt. To install Grub to your system now type:
Code:
grub-install --root-directory=/mnt /dev/sda
This will install Grub to the MBR of /dev/sda and point it to /dev/sdb1. Of course this will overwrite your MBR, but will otherwise not affect your Windows installation. If you now reboot your system you should have the Grub bootloader starting. It may be possible that it will only see the Linux, but not the Windows installation. This can easily be fixed by booting into Linux and launch the command
Code:
update-grub
This will scan your disk for operating systems and generate a new config-file for Grub.

Keep in mind that all these commands have to be launched as root, so depending on your distribution you will have to use sudo or login as root.
 
1 members found this post helpful.
Old 04-29-2011, 07:53 PM   #5
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
I just realized that since /dev/sdb is a flash card, it may not always be available during boot. If I set that as a root directory and try to boot without it, I'll be locked out from any OS, right?

Does regular grub support NTFS to store config file and images? For some reason, GRUB4DOS doesn't see the flash card.

Last edited by designator; 04-29-2011 at 07:57 PM.
 
Old 04-29-2011, 08:05 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You are right, if the card is not present the bootloader will not start. Normal Grub doesn't support to be installed to NTFS. Simple solution: Shrink your Windows partition, so that you can make a new partition at the end of sda. 500MB should be more than sufficient. Format this partition with a Linux files-system and use it as /boot-partition. This way your system will boot even if the flash-card is not present.
 
1 members found this post helpful.
Old 04-29-2011, 09:13 PM   #7
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
If you do not want to rewrite anything yet try grub2 on cd disk. If you like it then use instructions above to install to hd or use cd every time you want to boot flash.
 
Old 04-30-2011, 03:24 AM   #8
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Unfortunately I'm using a tablet without cd-rom drive, but I'm sure I can do the same with USB drive right?
I've only tested GRUB shell from Linux. I don't want to overwrite MBR without confirming first that GRUB can even see the flash card.

GRUB4Dos can't see it for some reason.
 
Old 04-30-2011, 04:07 AM   #9
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
In this case why not just use the windows boot loader?
 
Old 04-30-2011, 10:08 AM   #10
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I presume you have Suse or some type of linux on usb stick. If so boot and use command 'fdisk -l' and see if flash card is listed as a /dev. If it is you should be able to boot. I have an old desk top that will not boot usb so this is the method I use to boot usb. You can make a permanent entry in you grub.cfg when you have your /dev for the flash. You may have to use the same port everytime but I presume that should be no problem if it is an internal reader.

After tought:
I chainload mine and they are live cd images, not full installs.

Last edited by Larry Webb; 04-30-2011 at 10:10 AM.
 
Old 04-30-2011, 12:00 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can install both the MBR and grub to the external device, and edit Window's C:\BOOT.INI file to include an entry to chainload Linux using grub.
For Vista, there isn't a BOOT.INI file, but if you create one, it will use it. I don't know about Windows 7, but it probably will work for that as well. This method will leave the MBR on your main disk untouched. You are only changing a text file. You also need to use dd to copy the MBR of the external device to a file on C:\. This is what will chainload Linux.

This wiki entry has full instructions. There are also numerous howto's on this you can find using Google.
http://www.thinkwiki.org/wiki/How_to..._to_boot_Linux
 
Old 05-01-2011, 10:59 PM   #12
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by Larry Webb View Post
I presume you have Suse or some type of linux on usb stick. If so boot and use command 'fdisk -l' and see if flash card is listed as a /dev. If it is you should be able to boot. I have an old desk top that will not boot usb so this is the method I use to boot usb. You can make a permanent entry in you grub.cfg when you have your /dev for the flash. You may have to use the same port everytime but I presume that should be no problem if it is an internal reader.

After tought:
I chainload mine and they are live cd images, not full installs.

There is a /dev/ entry for it, but GRUB doesn't see it.

I tried to dump the first 512B from the MBR of the flash card and then point Windows Loader to the file using BCDEDIT.EXE, but all I get is a black screen.

Also, when I run
Code:
geometry (hd1)
from GRUB shell, I get the SD card geometry, but when I run
Code:
setup (hd1,1)
I get
Code:
Error 12: Invalid device requested.
 
Old 05-02-2011, 07:20 AM   #13
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
You need to chainload it, if it is installed version you need to create a mbr on the flash. If it is a live distro it will chainload without any modifications.

Here is a tutorial on grub2, after reading if you have problems ask back and I will help what I can.

grub2

Last edited by Larry Webb; 05-02-2011 at 07:26 AM.
 
Old 05-02-2011, 04:56 PM   #14
designator
Member
 
Registered: Jun 2003
Location: California, USA
Distribution: OpenSUSE Tumbleweed
Posts: 219

Original Poster
Rep: Reputation: 37
Quote:
Originally Posted by Larry Webb View Post
You need to chainload it, if it is installed version you need to create a mbr on the flash. If it is a live distro it will chainload without any modifications.
I'm guessing you're talking about Linux distro I'm running, right? Flash card has Android-x86, installed version, with GRUB in the MBR.

I installed GRUB2 in the MBR of another usb key and it runs correctly from that, but when I dump the MBR to a file and try to load it using Windows NTLDR, I just get a black screen with text "GRUB" and blinking cursor. It's not accepting any commands.

Also, it seems that dumping 512b wasn't enough because during installation GRUB2 complained that there wasn't enough space in the MBR until I moved the partition starting point to 4096b.
 
Old 05-02-2011, 06:19 PM   #15
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I can not help with the windows, no experience.
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install grub on a USB hard disk (not disk on key) zvivered Linux - Embedded & Single-board computer 4 07-22-2009 10:30 PM
'GRUB hard disk error' : config or BIOS problem ? bcostacurta Linux - Software 3 12-19-2008 03:15 AM
boot disk for grub; network config; printer pb abd_bela Debian 3 05-03-2006 12:20 PM
XP on a separate disk and GRUB config greg108 Linux - Newbie 3 08-10-2004 11:48 PM
1st HDD = RH9.0 (grub) ... How do I modify grub when adding 2nd hard disk ? Onyx^ Linux - Software 1 09-05-2003 09:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:27 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