Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
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.
hey need help regard this:
let's say i got Windows XP on hard disk (hda1), and ubuntu on (hdb1) but while installing XP, i lost the grub loader! i enter LIVE CD and install grub back to (hdb1) and try sudo grub , root (hdb1) , setup ( where i should use this in hda or hdb)? if i want to install GRUB as MBR ?
sudo fdisk -l
# fdisk -l
Disk /dev/hda: 80.0 GB, 80026361856 bytes
240 heads, 63 sectors/track, 10337 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1764 13335808+ 7 HPFS/NTFS
/dev/hda2 1765 10337 64811880 f W95 Ext'd (LBA)
/dev/hda5 1765 10161 63481288+ 7 HPFS/NTFS
/dev/hda6 10162 10337 1330528+ 7 HPFS/NTFS
Disk /dev/hdb: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 4681 37600101 83 Linux
/dev/hdb2 4682 4865 1477980 5 Extended
/dev/hdb5 4682 4865 1477948+ 82 Linux swap / Solaris
#
how i can solve this ? i know if both are on same hard disk i can do in LIVE CD sudo grub then root (hd0,0) then setup (hd0) but if windows is on HDD and Ubuntu on HDD how i can let this work using GRUB >?
Thanks alot =)
I think this will work: See which is the HDD that boots first, install GRUB on it and then configure it to point to hd(0,0) for WinXP or hd(1,0) for Ubuntu.
The safer way to go is using your mainboard's boot agent (if you have one) (Something like press F9 to select boot device) and select the hdd to boot from :-)
There has to be a bootloader on the MBR of the disk that the BIOS lists as bootable---the BIOS tries them in order. In you example, the drive with the Windows stuff on it is shown as hda because the BIOS saw it as the first harddrive.
Boot up from live CD and run fdisk to verify which drive is which----Assuming they are in the same order as you show, then do this:
Code:
grub
root (hd1,0)
setup (hd0)
Note the syntax and the numbering. First, you always use "hd" in grub, even if Linux shows the drives as "sd".
The grub numbering starts at zero, so (hd0,0) means the first drive, first partition.
/dev/sda = hd0
/dev/sda1 = hd0,0
/dev/hdb2 = hd1,1
etc....
As already pointed out, you can put grub in the mbr of the Linux drive, leave the XP bootloader, and use the BIOS to select which drive to boot.
There has to be a bootloader on the MBR of the disk that the BIOS lists as bootable---the BIOS tries them in order. In you example, the drive with the Windows stuff on it is shown as hda because the BIOS saw it as the first harddrive.
Boot up from live CD and run fdisk to verify which drive is which----Assuming they are in the same order as you show, then do this:
Code:
grub
root (hd1,0)
setup (hd0)
Note the syntax and the numbering. First, you always use "hd" in grub, even if Linux shows the drives as "sd".
The grub numbering starts at zero, so (hd0,0) means the first drive, first partition.
/dev/sda = hd0
/dev/sda1 = hd0,0
/dev/hdb2 = hd1,1
etc....
As already pointed out, you can put grub in the mbr of the Linux drive, leave the XP bootloader, and use the BIOS to select which drive to boot.
just last question
thanks alot for ur explanation and for Refractor last question
Assuming i have Ubuntu and XP and ubuntu install "/" as /dev/sda1 , can i install using sudo grub-install /dev/sda1 in LIVE CD ? if lost the grub ofcourse ? Regardless if there is /boot for or there is no /boot (maybe lost or removed by specific reason) ....Thanks alot =)
I never use "grub-install". Somewhere I read that it is better to use the GRUB shell method (as in my previous post). Doesn't "grub-install /dev/sda1" put GRUB on the partition boot sector? Normally you want GRUB on the MBR.
The "booting" link in my sig below might help----it includes a link to the GRUB manual.
simple thing you have to under stand in grub is grub is a small systm that runs on your mbr. Master Boot record or other option for like super block of root. Mbr is where I put it.
Quote:
# Linux bootable partition config begins
title Linux on (/dev/sda1)
root (hd0,0) <---- tells grub to go to drive sda1 or hda1 and look for the folder /boot/kernel image
kernel /boot/vmlinuz root=/dev/sda1 ro vga=normal <--- this tells the kernel image to sync with the /etc/fstab file (read the file) so it can find root. this one is on /dev/sda1 on my fstab.
# Linux bootable partition config ends
so all said and done grub looks for the drive then loads the kernel then the kernel init looks for /etc/fstab to find root .
yes this does mean you can use a krnel on drive sdb1 then boot the os root file system on drive sdc1. theses are options for people that need to boot many drives server and net boot ups.
so if you boot put grub on sda and the /boot/grub/menu.1st on sdb1 your linux partition.
so your grub would be
[QUOTE]title Linux on (/dev/sdb1)
root (hd1,0)
kernel /boot/vmlinuz root=/dev/sdb1 ro vga=normal
[QUOTE] and this must match your /etc/fstab file.
Quote:
/dev/sdb1 / ext3 defaults 1 1
When you have multiple systems the best way is to have a default /boot/grub/menu.1st
and edit to load each partition /boot/grub/menu.1st like this.
Quote:
title Linux sda1
root (hd0,0) <---This tells grub to hard drive sda1 and look for
configfile /boot/grub/menu.lst <-- this then load that menu to boot with.
title Linux sdc1
root (hd2,1) <-----same as above
configfile /boot/grub/menu.lst
I have installed grub on each of theses partition but my master /boot/grub/menu.1st is on
/dev/sda3
Well if your using 2 HDDs a simple and elligant solution is to unplug the hdd your not working with and do everything to the MBR. That fixed all my grub woes years ago. And I assumed your on 2 hdds because you have an hda and a hdb, which shouldn't happen with one hdd
Once your done, you can always edit grub's config to boot windows from it.
Last edited by mushroomboy; 08-10-2009 at 05:06 AM.
I've seen many posts where removing a disk caused problems after it was re-inserted. If the linux root partition is on the second disk, grub will be looking for it on the first disk.
I've seen many posts where removing a disk caused problems after it was re-inserted. If the linux root partition is on the second disk, grub will be looking for it on the first disk.
Yes you are right, but setting up the proper disc structure before installing is good too. I have 2xSATA and an ATA drive, since sata's get sdx names it doesn't change much for me as long as I have linux on the first SATA port. You should always know where your drivers are in the bios when you do something like this, it tells you weather it should be sda sdb sdc... ect. If you have a boot problem, you can always quick edit the paramaters in grub from hd0 to hd1 or hd2 (i had a screwed up grub once where my win partition was labled wrong for the hd0). I always recomend having linux on the first hdd when you install it and install grub, and do the same for windows, this is because linux is more picky where windows will boot if you mess up the hdd order. You can always edit windows into grub, it's not so fun putting your linux back on grub when it gets messed up. =P I always install linux with all the windows hard drives unplugged and vice versa. It makes sure that the bios isn't setting a "master hdd" so that the grub/win loaders don't piss me off. I hate installing windows and having it erase my grub, nothing like a missing grub to start the day.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.