LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-02-2009, 12:07 AM   #1
81bones
Member
 
Registered: Oct 2006
Location: Chicago, IL
Distribution: Almalinux
Posts: 66

Rep: Reputation: 15
Trying to fix boot loader with multiple OSes


I had a perfectly good install of Mandriva 2008.1 running on my computer but I recently decided to upgrade to a newer, bigger harddrive so I could set up the computer to dual-boot between Linux and Windows. So here's what I did. I installed a fresh copy of Windows XP Pro onto the new drive (the NTFS partition takes up about 1/3 of the drive). I then "cloned" the Linux partitions from my old Linux drive onto the empty space on the new drive -- so there are now a total of 4 partitions on the drive: 1 NTFS partition with WinXP and 3 Linux partitions for my Mandriva install. I am currently in the process of restoring the bootloader but I've run into some problems.

Right now, the system boots directly into Windows using the Windows boot loader. I attempted to restore the Linux boot loader I was using (Grub) using the Mandriva rescue disk -- it has an option to re-install the Linux boot loader. When I do the rescue, I get the following error:

Code:
Installing boot loader...
running: sh /boot/grub/install.sh with root /mnt

GNU GRUB version 0.97  (640K lower, 3072K upper memory)

grub> root (hd0,0)
 Filesystem type unknown, partition type 0x7
grub> setup --stage2=/boot/grub/stage2 (hd0)

Error 17: Cannot mount selected partition
I am able to mount my Linux partitions using the rescue console and read them, so here is some info that might help:

Code:
[root@rescue]# fdisk -l
Disk /dev/sda: 251. GB, 251059544064 bytes
16 heads, 63 sectors/track, 486459 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x000271ab

   Device Boot     Start          End      Blocks   Id  System
/dev/sda1   *          1       154413   77824120+    7  HPFS/NTFS
/dev/sda2         154414       236013   41126400    83  Linux
/dev/sda3         236014       473531  119709072     f  W95 Ext'd (LBA)
/dev/sda5         236014       244126    4088920+   82  Linux swap/Solaris
/dev/sda6         244127       473531  115620088+   83  Linux

[root@rescue]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/loop0
          squashfs     15M   15M     0 100% /tmp/stage2
/dev/sda2     ext3     39G  7.1G   30G  20% /mnt
[root@rescue]#
I can also see the Linux partitions from within the Windows Disk Manager, although for some reason I can't read them using the Ext2 IFS for Windows program (the drives show up in My Computer but when I try to open them Windows says they're empty and asks if I want to format them).

So with all of that info, my basic problem is this: I want to dual-boot Windows and Linux on my computer. I've done it before and it worked just fine (my laptop uses Grub to boot between Mandriva and WinXP, for example). I would be happy using either Grub or the Windows boot loader. I was hoping this would be real easy since I've used the rescue disk before to fix Grub, so this is a little frustrating. Does anyone know how to either re-install Grub (perhaps it's a dumb problem like Grub is trying to use the wrong partition?) or how to configure the Windows boot loader to list my Linux install as a bootable option? Thanks!!!
 
Old 02-02-2009, 12:46 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Your root should be (hd0,1) or (hd0,5) depending on which is your root directory.
 
Old 02-02-2009, 09:51 AM   #3
81bones
Member
 
Registered: Oct 2006
Location: Chicago, IL
Distribution: Almalinux
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal View Post
Your root should be (hd0,1) or (hd0,5) depending on which is your root directory.
Thanks jschiwal, that's kind of what I was thinking the problem might be but I just wanted to be sure before I tried something and really screwed it up. So if I understand correctly, then I should try to do something like this:

Code:
[root@rescue]# grub

grub> root (hd0,1)
grub> setup --stage2=/boot/grub/stage2 (hd0)
Does that seem correct? Thanks!
 
Old 02-02-2009, 02:14 PM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
What did you use to partition the drive with? If you used the windows install CD, it will make only 1 partition. Partition type 0x07 is Windows NTFS. After Windows makes its 1 partition, on which to install Windows, the remainder of the drive is free space. If by some diabolical scheme, you found a way to copy your linux installation directly to free space, you would have no corresponding entries in the disk partition table (MBR).

What you want to do is partition the entire disk first, just the way you want it, and put Windows on logical drive, within a extended partition. Then, put linux / in the first primary partition, /home in the second primary partition. swap in the extended partition, but not on the same logical drive as windows.

And I'll tell you something, Linux thought you were through with easy os's. The ones that take cash up front, and then blab everything you do in private all over the Internet. Linux is a classy os. She doesn't take kindly to those who are unfaithful, you, consorting with the disease infested slut Windows. Linux will abandon you, unless you make a commitment, and promise never to return to Windows.
 
Old 02-02-2009, 02:51 PM   #5
81bones
Member
 
Registered: Oct 2006
Location: Chicago, IL
Distribution: Almalinux
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by AwesomeMachine View Post
What did you use to partition the drive with? If you used the windows install CD, it will make only 1 partition. Partition type 0x07 is Windows NTFS. After Windows makes its 1 partition, on which to install Windows, the remainder of the drive is free space. If by some diabolical scheme, you found a way to copy your linux installation directly to free space, you would have no corresponding entries in the disk partition table (MBR).

What you want to do is partition the entire disk first, just the way you want it, and put Windows on logical drive, within a extended partition. Then, put linux / in the first primary partition, /home in the second primary partition. swap in the extended partition, but not on the same logical drive as windows.
I installed Windows first on the blank drive and used the Windows installer to create the single NTFS partition. This primary partition takes up about 1/3 of the space on the drive. I then used Norton Ghost to copy my Linux partitions (/, /home, and swap) to the blank space on the drive (this used to be called "drive cloning" or "ghosting" but they may use other terms now, not sure). These partitions take up approx. the remaining 2/3 of the drive. I would have gladly had Linux be the primary OS, but I've had problems in the past in which I've installed Linux first and Windows second (for example, on one system the Windows install wound up calling it's main drive G: instead of C: which causes problems for some programs, and this happened because Windows was installed after Linux). I've done a procedure similar to this in the past (moving a Linux install onto another disk) and it worked ok so I figured I'd try my luck again. If need be I will just re-install Linux onto the drive, but I'd really really like to avoid doing that since my current install has about a year's worth of customization.

As for your comment on the MBR; you may be correct. Is there any way I can write the entries for the Linux partitions into the MBR if necessary? Or perhaps this will work itself out if I can get Grub working again?

Quote:
Originally Posted by AwesomeMachine View Post
And I'll tell you something, Linux thought you were through with easy os's. The ones that take cash up front, and then blab everything you do in private all over the Internet. Linux is a classy os. She doesn't take kindly to those who are unfaithful, you, consorting with the disease infested slut Windows. Linux will abandon you, unless you make a commitment, and promise never to return to Windows.
How colorful! Actually the main reason I want the Windows install is for multimedia purposes. I use Linux to run my servers, program, do work stuff, etc. But when it comes to doing multimedia, Linux sucks. I'm not looking for an argument, it's just not as simple and easy as it is with Windows. I want my girlfriend to be able to use the Xbox to play music and streaming video from the computer, and with Windows all I need to do is use Windows Media Sharing or a program like PlayOn (which now works with Netflix and Hulu) and boom, done. Linux has uShare, which, while a valiant effort, doesn't quite match up to the various Windows-based options. Anyways, this is all discussion for another thread. I'm just looking to transfer my old Linux install to a new disk. Any help is appreciated. Thanks!
 
Old 02-02-2009, 05:38 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,503

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
So if I understand correctly, then I should try to do something like this:

[root@rescue]# grub
grub> root (hd0,1)
grub> setup --stage2=/boot/grub/stage2 (hd0)
No. Use your Mandriva disk, let it load, open a terminal/konsole and log in as root and type grub (to get the grub prompt then type

root (hd0,1)
setup (hd0)
quit

This will install stage1 of Grub to the mbr of the drive pointing to sda2 (hd0,1) for the rest of the bootloader files.


The error you quoted in your first post below:

Quote:
grub> root (hd0,0)
Filesystem type unknown, partition type 0x7
is because you were trying to install Grub on a windows partition indicated by the "0x7".
 
Old 02-02-2009, 06:24 PM   #7
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by AwesomeMachine View Post
And I'll tell you something, ... consorting with the disease infested slut Windows. ... return to Windows.
OP had the right word for the last paragraph of your post: "colorful" -- esp. the phrase I've colored. One of the finest mini-diatribes against "Winders"(tm) I've seen.

In this case, mixing the "theology" in w/ the advice did no harm, but I see the possibility of the less sophisticated not noticing your change in tone -- perhaps you should color your colorful words. I sometimes use silver to make my off-topic comments less eye catching.
 
Old 02-02-2009, 06:45 PM   #8
81bones
Member
 
Registered: Oct 2006
Location: Chicago, IL
Distribution: Almalinux
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by yancek View Post
No. Use your Mandriva disk, let it load, open a terminal/konsole and log in as root and type grub (to get the grub prompt then type

root (hd0,1)
setup (hd0)
quit

This will install stage1 of Grub to the mbr of the drive pointing to sda2 (hd0,1) for the rest of the bootloader files.
Thanks! This worked, and it installed Grub into the MBR of the drive. I did run into a new problem after I installed Grub: when the Grub menu came up there was initially an error that it could not find the graphical menu, so it loaded the text-based boot menu. When I selected linux from the menu, I got the following error:

Code:
Booting 'linux'

kernel (hd0,0)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=f71ff8b2-a08b-4494-825b-a3ecb464ce1f resume=/dev/sda5 splash=silent vga=788

Error 17: Cannot mount selected partition
As you can see, it was using my old Grub menu, which still points to hd0,0 instead of hd0,1. So I used the rescue disk again and edited Grub's menu.lst file and tada! I was able to boot back into my old Linux install. I am now working on adding the Windows partition to my boot menu. Thanks so much for the help!
 
  


Reply



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
Fix grub boot loader after installing windows xp alaios Ubuntu 2 07-23-2008 09:58 AM
Hiding partitions/OSes with boot loader KPOM Linux - General 1 01-28-2008 12:04 AM
GRUB boot loader and installing multiple distributions on one computer juyce Linux - General 3 06-27-2005 06:13 PM
How to fix grub boot loader? UltraSoul Linux - General 7 01-24-2005 04:52 AM
Organized Install/Boot of Multiple Linux OSes bardanes Linux - Software 5 10-24-2004 05:15 AM

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

All times are GMT -5. The time now is 09:46 AM.

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