LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   grub, sata detection and device.map to boot win xp (https://www.linuxquestions.org/questions/linux-general-1/grub-sata-detection-and-device-map-to-boot-win-xp-214677/)

krazibon3 08-07-2004 11:29 AM

grub, sata detection and device.map to boot win xp
 
i'm currently trying to get grub to boot win xp located on my sata hd, but i don't know how to get linux to detect my sata drive. The reason why it didn't detect it in the first place because i unplugged my SATA hd before i installed FC2 on my IDE hd.

Using fdisk -l i have:

**************************************************************************************************

Disk /dev/hda: 13.6 GB, 13676544000 bytes
255 heads, 63 sectors/track, 1662 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 1532 12201367+ 83 Linux
/dev/hda3 1533 1662 1044225 82 Linux swap

Disk /dev/hdb: 8455 MB, 8455200768 bytes
16 heads, 63 sectors/track, 16383 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdb4 * 1 1 0 0 Empty
Partition 4 does not end on cylinder boundary.

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4865 39078081 c W95 FAT32 (LBA)
/dev/sda2 4866 9729 39070080 f W95 Ext'd (LBA)
/dev/sda5 4866 9729 39070048+ b W95 FAT32

***************************************************************************************************

in my /boot/grub/device.map i have:

***************************************************************************************************
(fd0) /dev/fd0
(hd0) /dev/hda

**************************************************************************************************

Now i've plugged my SATA back and i'm trying to get linux to detect it so i can edit my grub.conf to boot windows XP. I've tried editing the device.map by adding the line >> (hd1) /dev/sda but that trick didn't work =(. Any ideas on how to do i go about this?

aus9 09-22-2004 07:52 AM

ignore grub for the moment.

Either edit your /etc/fstab to mount your windows at boot or better still see if you can mount it manually


open a terminal and type su to get root password then
create a directory under /mnt so its /mnt/xp
then mount xp partition under /mnt/xp the see if you can view its contents

commands
su
password
mkdir /mnt/xp
mount -t ntfs /dev/sda /mnt/xp
cd /mnt/xp
ls

aus9 09-23-2004 07:35 AM

I was hoping you may have responded but anyhow lets assume you can manually mount

1) edit your /etc/fstab file to add the line for Xp try

/dev/sda /mnt/xp ntfs ro 0 0
where ro means read only so we can't overwrite or delete with out a manual command to protect the innocent?

2) now for the grub

A) Since you already know about device.map......well done by the way

add last line

(hd1) /dev/sda

B) now edit your /boot/menu.lst or maybe if you have no such file its /etc/grub.conf

add new entry rename title if you prefer

title XP
rootnoverify (hd1,1) # your xp boot partition
hide (hd0,0) # your linux boot paritiion
hide (hd0,1) #as I did not ask which was your /boot and just to be paranoid
unhide (hd1,0)
map (hd1) (hd0)
map (hd0) (hd1) # trick windows into thinking its C drive is first drive first partition
makeactive # if windows was not bootable make it so
chainloader +1 # use windows boot loader
boot # go ahead make my day

please report back if success or failure to help others please

ahildoer 10-29-2004 03:00 PM

aus9,

I have a similar setup to krazibon3.

/dev/hda1 - /boot
/dev/hda2 - /

/dev/hdb1 - m:\ (fat32)

/dev/hde1 - c:\ (winxp ntfs filesystem) (sata)

I modified your directions to get grub to boot windows as well. Here is my grub.conf:

[root@laslo root]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/hda2
# initrd /initrd-version.img
#boot=/dev/hda1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core (2.6.8-1.521)
root (hd0,0)
kernel /vmlinuz-2.6.8-1.521 ro root=LABEL=/ vga=791 rhgb quiet
initrd /initrd-2.6.8-1.521.img
title Windows XP
rootnoverify (hd2,0) # your xp boot partition
unhide (hd2,0)
map (hd2) (hd0)
map (hd0) (hd2) # trick windows into thinking its C drive is first drive first partition
makeactive # if windows was not bootable make it so
chainloader +1 # use windows boot loader
boot # go ahead make my day



The first time I booted windows it worked fine. When i rebooted the computer, GRUB would not load. Got an Error 17. I had to boot off the Federoa Core 2 CD 1 and do a linux rescue. Assuming my MBR was hosed, I tried to re-install grub manually like so:

$ grub
grub> root (hd0,0) # This is where it fails, saying unknown filesystem
grub> setup (hd0)

So, I get into fdisk

$ fdisk /dev/hda
: p

Disk /dev/hda: 40.0 GB, 40025947648 bytes
16 heads, 63 sectors/track, 77555 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 203 102280+ 93 Amoeba
/dev/hda2 204 36774 18431784 93 Amoeba
/dev/hda3 36775 38854 1048320 82 Linux swap
/dev/hda4 38855 77555 19505304 83 Linux


Notice how /dev/hda1 and /dev/hda2 are both 93 Amoeba and not 83 Linux
So i reset them and save:
: t
: 1
: 83
: t
: 2
: 83
: w

Then I go back in grub and it installs on the MBR no problem. I reboot and linux boots fine.
I tried rebooting windows again, and again it gets hosed. After fixing everything again i try something new. I had set in my bios (gigabyte GA-7VT600 1394) for sata to show up as 'ide' and not 'raid'. Tried windows again, no new changes to grub.conf yet. Now when i choose windows, i get black screen with white text showing this :

rootnoverify (hd2,0) # your xp boot partition
unhide (hd2,0)
map (hd2) (hd0)
map (hd0) (hd2) # trick windows into thinking its C drive is first drive first partition
makeactive # if windows was not bootable make it so
chainloader +1 # use windows boot loader
boot # go ahead make my day

then it hangs forever till i do a hard reboot

Any ideas?


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