View Full Version : Dualboot Two Hard Drives
unutbu
June 18th, 2009, 07:08 PM
val_u, I'm really glad you've got it working now.
Here is what I think was happening:
When you are booted into Linux, GRUB names the hard drives in the same order that Linux lists the hard drives.
But when you are booting the computer, GRUB names the hard drives in the order that the BIOS lists the hard drives.
Usually Linux and the BIOS list the drives in the same order, but that is not always the case. So what looks like sdc or (hd2) while booted into Linux, may be called something else when booting the computer.
There is a way to use /boot/grub/device.map to force GRUB to name the drives in the order you desire. But instead of messing with that, I suggested the crude method of simply trying all possibilities.
See http://ubuntuforums.org/showpost.php?p=3518911&postcount=9 for an example of how to use device.map to solve the problem. I think you were almost there, you just needed to do steps 9--14.
val_u
June 19th, 2009, 01:37 AM
And I suspected it has something to do with different HDD order! You didn't only help me, you explained me the cause. Thanks again.
According to device.map... It didn't word for me. But I'm not sure it isn't an off-topic here. And I can't post in the thread pointed to by your link. Where should I ask about different result on step 11 there?
unutbu
June 19th, 2009, 07:07 AM
val_u, I think it would be alright if you posted your question here.
May I offer you a suggestion, however? If your current boot setup works, don't fix it. If you use mbwardle's instructions wrong, your system may become unbootable.
As long as you are aware of this, and just want to learn or make your boot setup "perfect", I'm willing to try to help.
The correct command to use in step 11 depends on which drive you've told the BIOS to boot from.
PS. And finally, just so you'll know in the future, it is possible to post in the other thread. I only linked to a single post. To reply, you would need to click in the upper-right corner of the page on "Thread: Grub error 17". That will take you to the thread containing mbwardle's post. From there you could post a reply.
val_u
June 19th, 2009, 12:41 PM
val_u, I think it would be alright if you posted your question here.
Ok, I'll explain what I did.
May I offer you a suggestion, however? If your current boot setup works, don't fix it.The question is more interested. I did the instructions how to change mapping. And it works, but in the strange way...
If you use mbwardle's instructions wrong, your system may become unbootable. Yes, I know that. That's why I don't do advices at once. I want to understand what's going on under the hood. Maybe someday I will help somebody with that.
As long as you are aware of this, and just want to learn or make your boot setup "perfect", I'm willing to try to help.Yes, I want to do my system perfect. And I appreciate your help and advices very much.
The correct command to use in step 11 depends on which drive you've told the BIOS to boot from.BIOS sees in the order sdc, sda, sdb and boots from sdb.
PS. And finally, just so you'll know in the future, it is possible to post in the other thread. I only linked to a single post. To reply, you would need to click in the upper-right corner of the page on "Thread: Grub error 17". That will take you to the thread containing mbwardle's post. From there you could post a reply.Yes, I noticed that you gave me the link to a single post. But there is is written:
You are browsing a READ only archive
:-)
I'm going to explain what I did in the next post...
val_u
June 19th, 2009, 01:22 PM
So I studied the mbwardle (http://ubuntuforums.org/member.php?u=31200)'s instructions.
Some details:
three HDD, which BIOS sees in the order sdc, sda, sdb and boots from sdb.
Win is on sdc, Ubuntu is on sdb.
When I was installing Ubuntu, there was the button Advanced. I don't remember clearly, but probably that was about Grub. And I installed it on sdb2. As I understand it should be visible as /boot, but fstab doesn't have such record.
So I booted Ubunty (from HDD, not from LiveCD if it matters) and changed device.map from
(hd0) /dev/sda
(hd1) /dev/sdb
(hd2) /dev/sdc
to
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
Then I ran grub --device.map=device.map
Step 10 tells: Type "root (hd1,0)" (where hd1,0 is your Linux boot or root partition using the BIOS order)
I typed root (hd2,1)
(I expected my /boot partition there). It answered Ok.
I typed setup (hd2)
It answered that cannot find some files in the /root/boot, (filenames ended on stage-something).
So I returned to the previous step and tried using the root partition instead of boot.
root (hd2,7)
# / was on /dev/sdb8 during installation <= from fstab
Got Ok.
I typed setup (hd2).
From instruction: You should see a message that it's now telling GRUB to load 17+(hd1,0) instead of 17+(hd2,0) or something like that. This is what we want.
But I saw only few OK and Successful. Nothing like in the instruction.
So I quit from grub and added
title Microsoft Windows XP Professional - reordered
rootnoverify (hd0,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
and rebooted. And only sequence to successfull booting Win was the same that you previosly gave me:
title Microsoft Windows XP Professional (hd1,0)
rootnoverify (hd1,0)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
After I decided to run from Ubuntu:
grub --device.map=device.map
root (hd2,7)
setup (hd2,1)
It answered few OK and two "couldn't. It's not fatal".
After this while booting I can see additional text - something about stage 1.5
So for now I have right mapping in the device.map, but in the menu.lst right sequence doesn't work. And I've got additional text while booting from GRUB (stage 1.5)
So I can't understand how mapping could be right, but Win still boots from hd1, instead of hd0 and how can I fix that.
unutbu
June 19th, 2009, 02:12 PM
I'm surprised by the responses GRUB is giving you.
Could you please run boot_info_script (http://ubuntuforums.org/showpost.php?p=6725571&postcount=3) and post the RESULTS.txt file?
val_u
June 19th, 2009, 02:39 PM
I've read GRUB message while booting. It says
Loading stage1.5
few empty lines, and
Loading GRUB
Then comes the menu.
Little notice: /dev/sdh is a flash drive
============================= Boot Info Summary: ==============================
=> Windows is installed in the MBR of /dev/sda
=> Grub0.97 is installed in the MBR of /dev/sdb and looks on the same drive
in partition #8 for /boot/grub/stage2 and /boot/grub/menu.lst.
=> Windows is installed in the MBR of /dev/sdc
=> No known boot loader is installed in the MBR of /dev/sdh
sda1: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs:
sda2: __________________________________________________ _______________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sda5: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda5 starts
at sector 63.
Operating System:
Boot files/dirs:
sda6: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sda6 starts
at sector 63.
Operating System:
Boot files/dirs:
sdb1: __________________________________________________ _______________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sdb5: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sdb5 starts
at sector 63.
Operating System:
Boot files/dirs:
sdb6: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sdb6 starts
at sector 63.
Operating System:
Boot files/dirs:
sdb7: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sdb7 starts
at sector 63.
Operating System:
Boot files/dirs:
sdb8: __________________________________________________ _______________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 9.04
Boot files/dirs: /boot/grub/menu.lst /etc/fstab
sdb9: __________________________________________________ _______________________
File system: swap
Boot sector type: -
Boot sector info:
sdb10: __________________________________________________ _______________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:
sdb11: __________________________________________________ _______________________
File system: ext3
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:
sdb2: __________________________________________________ _______________________
File system: ext3
Boot sector type: Grub
Boot sector info: Grub0.97 is installed in the boot sector of sdb2 and
looks at sector 2273674 of the same hard drive for the
stage2 file. A stage2 file is at this location on
/dev/sdb. Stage2 looks on partition #8 for
/boot/grub/menu.lst.
Operating System:
Boot files/dirs:
sdc1: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM
sdc2: __________________________________________________ _______________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
sdc5: __________________________________________________ _______________________
File system: vfat
Boot sector type: MSWIN4.1: Fat 32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs:
sdc6: __________________________________________________ _______________________
File system: ntfs
Boot sector type: Windows XP
Boot sector info: According to the info in the boot sector, sdc6 starts
at sector 63.
Operating System:
Boot files/dirs:
sdh1: __________________________________________________ _______________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed:
mount: unknown filesystem type ''
sdh2: __________________________________________________ _______________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed:
mount: unknown filesystem type ''
sdh3: __________________________________________________ _______________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed:
mount: unknown filesystem type ''
sdh4: __________________________________________________ _______________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed:
mount: unknown filesystem type ''
=========================== Drive/Partition Info: =============================
Drive: sda ___________________ __________________________________________________ ___
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x407752c6
Partition Boot Start End Size Id System
/dev/sda1 * 63 71,682,029 71,681,967 7 HPFS/NTFS
/dev/sda2 71,682,030 625,137,344 553,455,315 f W95 Ext d (LBA)
/dev/sda5 71,682,093 256,011,839 184,329,747 7 HPFS/NTFS
/dev/sda6 256,011,903 625,137,344 369,125,442 7 HPFS/NTFS
Drive: sdb ___________________ __________________________________________________ ___
Disk /dev/sdb: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x8a75d228
Partition Boot Start End Size Id System
/dev/sdb1 192,904 1,465,149,167 1,464,956,264 f W95 Ext d (LBA)
/dev/sdb5 235,520,271 645,121,007 409,600,737 7 HPFS/NTFS
/dev/sdb6 645,121,071 1,054,721,807 409,600,737 7 HPFS/NTFS
/dev/sdb7 1,054,721,871 1,465,149,167 410,427,297 7 HPFS/NTFS
/dev/sdb8 192,906 15,824,024 15,631,119 83 Linux
/dev/sdb9 15,824,088 31,455,269 15,631,182 82 Linux swap / Solaris
/dev/sdb10 31,455,333 35,375,129 3,919,797 83 Linux
/dev/sdb11 35,375,193 56,195,369 20,820,177 83 Linux
/dev/sdb2 * 63 48,194 48,132 83 Linux
Drive: sdc ___________________ __________________________________________________ ___
Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x30bfa281
Partition Boot Start End Size Id System
/dev/sdc1 * 63 29,913,029 29,912,967 7 HPFS/NTFS
/dev/sdc2 29,913,030 312,576,704 282,663,675 f W95 Ext d (LBA)
/dev/sdc5 29,913,093 124,134,254 94,221,162 b W95 FAT32
/dev/sdc6 124,134,318 312,576,704 188,442,387 7 HPFS/NTFS
Drive: sdh ___________________ __________________________________________________ ___
Disk /dev/sdh: 1020 MB, 1020748288 bytes
32 heads, 61 sectors/track, 1021 cylinders, total 1993649 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x6f20736b
Partition Boot Start End Size Id System
/dev/sdh1 ? 778,135,908 1,919,645,538 1,141,509,631 72 Unknown
/dev/sdh2 ? 168,689,522 2,104,717,761 1,936,028,240 65 Novell Netware 386
/dev/sdh3 ? 1,869,881,465 3,805,909,656 1,936,028,192 79 Unknown
/dev/sdh4 ? 2,885,681,152 2,885,736,650 55,499 d Unknown
/dev/sdh1 ends after the last sector of /dev/sdh
/dev/sdh1 overlaps with /dev/sdh2
/dev/sdh1 overlaps with /dev/sdh3
/dev/sdh2 ends after the last sector of /dev/sdh
/dev/sdh2 overlaps with /dev/sdh3
/dev/sdh3 ends after the last sector of /dev/sdh
/dev/sdh3 overlaps with /dev/sdh4
/dev/sdh4 ends after the last sector of /dev/sdh
blkid -c /dev/null: __________________________________________________ __________
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="364C30424C2FFAEF" LABEL="dvd" TYPE="ntfs"
/dev/sda5: UUID="966C623B6C621671" LABEL="New Volume" TYPE="ntfs"
/dev/sda6: UUID="2438C4D738C4A8DE" TYPE="ntfs"
/dev/sdb2: UUID="4db9ad07-be0e-471d-8a07-d1d720db9d96" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb5: UUID="46EC15DBEC15C5D9" TYPE="ntfs"
/dev/sdb6: UUID="00C83D08C83CFD8A" LABEL="good_humor" TYPE="ntfs"
/dev/sdb7: UUID="0EE4511BE45105FD" TYPE="ntfs"
/dev/sdb8: UUID="0fe8321f-06a9-4c7e-9fa1-fe8fc0589071" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb9: UUID="99c2c780-b218-42ce-ad79-515db875c8a3" TYPE="swap"
/dev/sdb10: UUID="6d651c88-3b9a-4d77-a5c0-d3b0be5e6e1f" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdb11: UUID="1686d105-25dd-418a-8a02-86ec34d44371" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdc1: UUID="1A0854A308547FA5" TYPE="ntfs"
/dev/sdc5: UUID="8E1E-4E76" TYPE="vfat"
/dev/sdc6: UUID="0E284AA5284A8BA1" LABEL="New Volume" TYPE="ntfs"
/dev/sdh: UUID="78EA-ED11" TYPE="vfat"
=============================== "mount" output: ===============================
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /lib/modules/2.6.28-11-generic/volatile type tmpfs (rw,mode=0755)
tmpfs on /lib/modules/2.6.28-11-generic/volatile type tmpfs (rw,mode=0755)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
rootfs on / type rootfs (rw)
/dev/sr0 on /cdrom type iso9660 (ro,noatime)
/dev/loop0 on /rofs type squashfs (ro,noatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/ubuntu/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=ubuntu)
/dev/sdh on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=9 99,utf8,umask=077,flush)
=========================== sdb8/boot/grub/menu.lst: ===========================
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro
## default grub root device
## e.g. groot=(hd0,0)
# groot=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=detect
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro quiet splash
initrd /boot/initrd.img-2.6.28-11-generic
quiet
title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro single
initrd /boot/initrd.img-2.6.28-11-generic
title Ubuntu 9.04, memtest86+
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdc1
title Microsoft Windows XP Professional
rootnoverify (hd2,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
# following lines are made by val
title XP1 (+makeactive)
rootnoverify (hd2,0)
savedefault
makeactive
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
title Microsoft Windows XP Professional (hd1,0)
rootnoverify (hd1,0)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
title Microsoft Windows XP Professional (hd0,0)
rootnoverify (hd0,0)
savedefault
chainloader +1
# these are after changing hdd order
title Microsoft Windows XP Professional (after reordering)
rootnoverify (hd0,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
=============================== sdb8/etc/fstab: ===============================
# /etc/fstab: static file system information.
#
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sdb8 during installation
UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 / ext3 relatime,errors=remount-ro 0 1
# /tmp was on /dev/sdb10 during installation
UUID=6d651c88-3b9a-4d77-a5c0-d3b0be5e6e1f /tmp ext3 relatime 0 2
# /usr was on /dev/sdb11 during installation
UUID=1686d105-25dd-418a-8a02-86ec34d44371 /usr ext3 relatime 0 2
# swap was on /dev/sdb9 during installation
UUID=99c2c780-b218-42ce-ad79-515db875c8a3 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
=================== sdb8: Location of files loaded by Grub: ===================
1.0GB: boot/grub/menu.lst
1.1GB: boot/grub/stage2
1.1GB: boot/initrd.img-2.6.28-11-generic
1.1GB: boot/vmlinuz-2.6.28-11-generic
1.1GB: initrd.img
1.1GB: vmlinuz
================================ sdc1/boot.ini: ================================
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOW S
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
=========================== Unknown MBRs/Boot Sectors/etc =======================
Unknown MBR on /dev/sdh
00000000 eb 58 90 4d 53 44 4f 53 35 2e 30 00 02 08 20 00 |.X.MSDOS5.0... .|
00000010 02 00 00 00 00 f8 00 00 3f 00 ff 00 00 00 00 00 |........?.......|
00000020 b1 6b 1e 00 98 07 00 00 00 00 00 00 02 00 00 00 |.k..............|
00000030 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 29 11 ed ea 78 4e 4f 20 4e 41 4d 45 20 20 |..)...xNO NAME |
00000050 20 20 46 41 54 33 32 20 20 20 33 c9 8e d1 bc f4 | FAT32 3.....|
00000060 7b 8e c1 8e d9 bd 00 7c 88 4e 02 8a 56 40 b4 08 |{......|.N..V@..|
00000070 cd 13 73 05 b9 ff ff 8a f1 66 0f b6 c6 40 66 0f |..s......f...@f.|
00000080 b6 d1 80 e2 3f f7 e2 86 cd c0 ed 06 41 66 0f b7 |....?.......Af..|
00000090 c9 66 f7 e1 66 89 46 f8 83 7e 16 00 75 38 83 7e |.f..f.F..~..u8.~|
000000a0 2a 00 77 32 66 8b 46 1c 66 83 c0 0c bb 00 80 b9 |*.w2f.F.f.......|
000000b0 01 00 e8 2b 00 e9 48 03 a0 fa 7d b4 7d 8b f0 ac |...+..H...}.}...|
000000c0 84 c0 74 17 3c ff 74 09 b4 0e bb 07 00 cd 10 eb |..t.<.t.........|
000000d0 ee a0 fb 7d eb e5 a0 f9 7d eb e0 98 cd 16 cd 19 |...}....}.......|
000000e0 66 60 66 3b 46 f8 0f 82 4a 00 66 6a 00 66 50 06 |f`f;F...J.fj.fP.|
000000f0 53 66 68 10 00 01 00 80 7e 02 00 0f 85 20 00 b4 |Sfh.....~.... ..|
00000100 41 bb aa 55 8a 56 40 cd 13 0f 82 1c 00 81 fb 55 |A..U.V@........U|
00000110 aa 0f 85 14 00 f6 c1 01 0f 84 0d 00 fe 46 02 b4 |.............F..|
00000120 42 8a 56 40 8b f4 cd 13 b0 f9 66 58 66 58 66 58 |B.V@......fXfXfX|
00000130 66 58 eb 2a 66 33 d2 66 0f b7 4e 18 66 f7 f1 fe |fX.*f3.f..N.f...|
00000140 c2 8a ca 66 8b d0 66 c1 ea 10 f7 76 1a 86 d6 8a |...f..f....v....|
00000150 56 40 8a e8 c0 e4 06 0a cc b8 01 02 cd 13 66 61 |V@............fa|
00000160 0f 82 54 ff 81 c3 00 02 66 40 49 0f 85 71 ff c3 |..T.....f@I..q..|
00000170 4e 54 4c 44 52 20 20 20 20 20 20 00 00 00 00 00 |NTLDR .....|
00000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 0d 0a 52 65 |..............Re|
000001b0 6d 6f 76 65 20 64 69 73 6b 73 20 6f 72 20 6f 74 |move disks or ot|
000001c0 68 65 72 20 6d 65 64 69 61 2e ff 0d 0a 44 69 73 |her media....Dis|
000001d0 6b 20 65 72 72 6f 72 ff 0d 0a 50 72 65 73 73 20 |k error...Press |
000001e0 61 6e 79 20 6b 65 79 20 74 6f 20 72 65 73 74 61 |any key to resta|
000001f0 72 74 0d 0a 00 00 00 00 00 ac cb d8 00 00 55 aa |rt............U.|
00000200
Unknown BootLoader on sdh1
Unknown BootLoader on sdh2
Unknown BootLoader on sdh3
Unknown BootLoader on sdh4
=======Devices which don't seem to have a corresponding hard drive==============
sdd sde sdf sdg
=============================== StdErr Messages: ===============================
hexdump: /dev/sdh1: No such file or directory
hexdump: /dev/sdh1: No such file or directory
hexdump: /dev/sdh2: No such file or directory
hexdump: /dev/sdh2: No such file or directory
hexdump: /dev/sdh3: No such file or directory
hexdump: /dev/sdh3: No such file or directory
hexdump: /dev/sdh4: No such file or directory
hexdump: /dev/sdh4: No such file or directory
unutbu
June 19th, 2009, 03:21 PM
mbwardle's post has a typographical error: the correct command is
sudo grub --device-map=device.map
not
sudo grub --device.map=device.map
Notice the period should be a hyphen.
Did you already notice this typo? If you ran the command with the period you should have gotten an error:
% sudo grub --device.map=device.map
grub: unrecognized option '--device.map=device.map'
Try ``grub --help'' for more information.
The RESULTS.txt output seems to suggest that sdb2 is not being used as a /boot partition. I don't think this partition contains any boot files. The sdb8 partition contains the /boot directory. That is why "root (hd2,7)" succeeded, but "root (hd2,1)" did not.
Now to fix the device map. Do the following experiment:
sudo grub
grub> geometry (hd0)
grub> geometry (hd1)
grub> geometry (hd2)
You should see something like:
grub> geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
...
grub> geometry (hd1)
drive 0x81: C/H/S = 60801/255/63, The number of sectors = 976773168, /dev/sdb
...
grub> geometry (hd2)
drive 0x82: C/H/S = 243/255/63, The number of sectors = 3915776, /dev/sdc
...
The details will be different, but notice how (hd0) is associated with /dev/sda,
(hd1) with sdb, and (hd2) is associated with sdc.
Now quit grub and run this:
cd /boot/grub
cat device.map
Check that you should see:
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
sudo grub --device-map=device.map
grub> geometry (hd0)
grub> geometry (hd1)
grub> geometry (hd2)
Now you should see
grub> geometry (hd0)
drive 0x80: C/H/S = 243/255/63, The number of sectors = 3915776, /dev/sdc
...
grub> geometry (hd1)
drive 0x81: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
...
grub> geometry (hd2)
drive 0x82: C/H/S = 60801/255/63, The number of sectors = 976773168, /dev/sdb
...
Notice how the associations are now different:
(hd0) <--> sdc
(hd1) <--> sda
(hd2) <--> sdb
just like you defined them in /boot/grub/device.map.
Verify that you get the right output from the geometry commands.
Once you've got that working, then proceed (again) with mbwardle's instructions:
root (hd2,7)
setup (hd2)
quit
Now since (hd0) is sdc, you should be able to boot XP with this menu.lst boot stanza:
title Microsoft Windows XP Professional (hd0,0)
rootnoverify (hd0,0)
savedefault
chainloader +1
If this does not work, but booting (hd1,0) does work, then it means your Windows XP is on sda1, rather than sdc1.
title Microsoft Windows XP Professional (after reordering)
rootnoverify (hd0,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
The map commands swap the meaning of (hd0) and (hd2) right before booting Windows.
This is done because Windows expects itself to be on the first boot drive, (hd0).
Since we are using device.map to make (hd0) the Windows drive, you should not need
the map commands. Indeed, whenever (hd0,Y) is used on the rootnoverify (or root) line in menu.lst,
rootnoverify (hd0,0)
you should not use map commands.
Hope this helps.
val_u
June 19th, 2009, 03:34 PM
unutbu (http://ubuntuforums.org/member.php?u=518895), I noticed that typo with -/.
One more question: can I do that from Ubuntu on my HDD? Or should I use the LiveCD?
P. S. Win is definitely on sdc1. I'm 100% sure about it.
unutbu
June 19th, 2009, 03:51 PM
You can run all the grub commands while booted into Ubuntu.
Most GRUB instructions say boot from the LiveCD only because most people can't boot by the time they mess with GRUB.
val_u
June 19th, 2009, 04:24 PM
I've tried.
valery@val-desktop:~$ cat /boot/grub/device.map
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
valery@val-desktop:~$ sudo grub
[sudo] password for valery:
Probing devices to guess BIOS drives. This may take a long time.
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> geometry (hd0)
geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> geometry (hd1)
geometry (hd1)
drive 0x81: C/H/S = 25665/255/63, The number of sectors = 1465149168, /dev/sdb
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
Partition num: 6, Filesystem type unknown, partition type 0x7
Partition num: 7, Filesystem type is ext2fs, partition type 0x83
Partition num: 8, Filesystem type unknown, partition type 0x82
Partition num: 9, Filesystem type is ext2fs, partition type 0x83
Partition num: 10, Filesystem type is ext2fs, partition type 0x83
grub> geometry (hd2)
geometry (hd2)
drive 0x82: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/sdc
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is fat, partition type 0xb
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> quit
quit
valery@val-desktop:~$ cd /boot/grub
valery@val-desktop:/boot/grub$ cat device.map
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
valery@val-desktop:/boot/grub$ sudo grub --device-map=device.map
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> geometry (hd0)
geometry (hd0)
drive 0x80: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/sdc
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is fat, partition type 0xb
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> geometry (hd1)
geometry (hd1)
drive 0x81: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> geometry (hd2)
geometry (hd2)
drive 0x82: C/H/S = 25665/255/63, The number of sectors = 1465149168, /dev/sdb
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
Partition num: 6, Filesystem type unknown, partition type 0x7
Partition num: 7, Filesystem type is ext2fs, partition type 0x83
Partition num: 8, Filesystem type unknown, partition type 0x82
Partition num: 9, Filesystem type is ext2fs, partition type 0x83
Partition num: 10, Filesystem type is ext2fs, partition type 0x83
grub> root (hd2,7)
root (hd2,7)
grub> setup (hd2)
setup (hd2)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd2)"... 17 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd2) (hd2)1+17 p (hd2,7)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> quit
quit
valery@val-desktop:/boot/grub$ cat /boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 10
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro
## default grub root device
## e.g. groot=(hd0,0)
# groot=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=detect
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro quiet splash
initrd /boot/initrd.img-2.6.28-11-generic
quiet
title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=0fe8321f-06a9-4c7e-9fa1-fe8fc0589071 ro single
initrd /boot/initrd.img-2.6.28-11-generic
title Ubuntu 9.04, memtest86+
uuid 0fe8321f-06a9-4c7e-9fa1-fe8fc0589071
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
# This is a divider, added to separate the menu items below from the Debian
# ones.
title Other operating systems:
root
# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sdc1
title Microsoft Windows XP Professional
rootnoverify (hd2,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
# following lines are made by val
title XP1 (+makeactive)
rootnoverify (hd2,0)
savedefault
makeactive
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
title Microsoft Windows XP Professional (hd1,0)
rootnoverify (hd1,0)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
title Microsoft Windows XP Professional (hd0,0)
rootnoverify (hd0,0)
savedefault
chainloader +1
# these are after changing hdd order
title Microsoft Windows XP Professional (after reordering)
rootnoverify (hd0,0)
savedefault
map (hd0) (hd2)
map (hd2) (hd0)
chainloader +1
valery@val-desktop:/boot/grub$
Then rebooted. I chose in the menu item Microsoft Windows XP Professional (hd0,0)
It gave me infinite Starting up....
I chose Microsoft Windows XP Professional (hd1,0)
It successfully loaded Win.
I booted Ubuntu.
valery@val-desktop:~$ sudo grub
[sudo] password for valery:
Probing devices to guess BIOS drives. This may take a long time.
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> geometry (hd0)
geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> geometry (hd1)
geometry (hd1)
drive 0x81: C/H/S = 25665/255/63, The number of sectors = 1465149168, /dev/sdb
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
Partition num: 6, Filesystem type unknown, partition type 0x7
Partition num: 7, Filesystem type is ext2fs, partition type 0x83
Partition num: 8, Filesystem type unknown, partition type 0x82
Partition num: 9, Filesystem type is ext2fs, partition type 0x83
Partition num: 10, Filesystem type is ext2fs, partition type 0x83
grub> geometry (hd2)
geometry (hd2)
drive 0x82: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/sdc
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is fat, partition type 0xb
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> quit
quit
valery@val-desktop:~$ cat /boot/grub/device.map
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
valery@val-desktop:~$
As you can see nothing changed.
And I remembered one detail. While installing Ubuntu, I chose that small /dev/sdb8 as a /boot. And after that button Advanced, I chose it for dual system booting.
unutbu
June 19th, 2009, 05:06 PM
Okay, val_u. I think I understand now that I have been operating under a misunderstanding of what device.map does.
The BIOS decides on an order for the hard drives. We basically do not have control over this (unless you reprogram the BIOS, or physically swap the cables connecting the drives to the computer). GRUB uses the BIOS's drive order to assign a mapping between (hdX) and physical drives. Since this depends on the BIOS, we don't have a choice about this either.
All that device.map can do for us is tell GRUB (while running Linux) to use a particular mapping between (hdX) and the physical drives. (By the time you are running Linux, GRUB seems to forget the BIOS drive order and instead rely on the order in which Linux lists the drives.) Although you can use device.map to create any mapping you like, since the BIOS's drive order is immutable, there is only one useful mapping -- the mapping that matches the BIOS's choices.
In mbwardle's example, he changes his device.map to conform to the BIOS order.
Then his "root (hdX,Y)" and "setup (hdX)" commands can use the same terminology as GRUB would find while booting. That's all it does.
So the best we can do is edit device.map to
(hd0) /dev/sda
(hd1) /dev/sdc
(hd2) /dev/sdb
Since you already have found this to work,
title Microsoft Windows XP Professional (hd1,0)
rootnoverify (hd1,0)
savedefault
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
we can conclude that the BIOS believes sdc is your second drive. I can be wrong, but I now believe this condition is immutable unless you physically swap hard drive cables.
Apologies for leading you on this wild goose chase...
val_u
June 19th, 2009, 05:46 PM
unutbu, there is nothing to apologize for. It was interesting and was getting clearer for me until your last post...
I have a long story with linux. I'm not a big fan of Win, so many years ago I decided to install Linux. I got three different installation (one of them was Red hat) from three different people. And every installation ended with signal 9 while installing. None of these people could resolve that problem. So I stuck up with OS/2 for years (which installed successfully without any signals). So I think Linux again shows its love to me :-)
Now to the HDD order. About 6 months ago I switched cables to get order sdc, sda, sdb.
sdc is IDE, sda and sdb are PATA.
This order is in the BIOS HDD menu, in the boot order menu, while booting PC. And even Win sees disks in this order. So I think we missed something.
Your theory isn't right because of device.map. When is it used? While booting on the GRUB stage? No - it doesn't boot Win from where it is in the device.map.
When Ubuntu is loaded? But why I got:
valery@val-desktop:~$ sudo grub
[sudo] password for valery:
Probing devices to guess BIOS drives. This may take a long time.
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> geometry (hd0)
geometry (hd0)
drive 0x80: C/H/S = 38913/255/63, The number of sectors = 625142448, /dev/sda
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> geometry (hd1)
geometry (hd1)
drive 0x81: C/H/S = 25665/255/63, The number of sectors = 1465149168, /dev/sdb
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 4, Filesystem type unknown, partition type 0x7
Partition num: 5, Filesystem type unknown, partition type 0x7
Partition num: 6, Filesystem type unknown, partition type 0x7
Partition num: 7, Filesystem type is ext2fs, partition type 0x83
Partition num: 8, Filesystem type unknown, partition type 0x82
Partition num: 9, Filesystem type is ext2fs, partition type 0x83
Partition num: 10, Filesystem type is ext2fs, partition type 0x83
grub> geometry (hd2)
geometry (hd2)
drive 0x82: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/sdc
Partition num: 0, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is fat, partition type 0xb
Partition num: 5, Filesystem type unknown, partition type 0x7
grub> quit
quit
valery@val-desktop:~$ cat /boot/grub/device.map
(hd0) /dev/sdc
(hd1) /dev/sda
(hd2) /dev/sdb
valery@val-desktop:~$
That's again not the device.map order. And as you could see Microsoft Windows XP Professional (hd1,0) loaded the same Win with two different device.map. We just missed something...
unutbu
June 19th, 2009, 07:26 PM
If you follow the thread after mbwardle's post, there is more discussion about device.map mainly between MQMike and Herman.
Check out Herman's massive experiment:
http://ubuntuforums.org/showpost.php?p=3650311&postcount=33
Here he attempts to purposefully messup his device.map, reinstall GRUB, and see if device.map has any affect on his installation. It never does.
I know I can be wrong on matters of GRUB, BIOS (and most things in general), but as far as I can see my previous explanation is consistent with all the evidence. The device.map is not read at boot time, it does not affect how GRUB names the devices at boot time. It only affects how GRUB names the devices when running "sudo grub" from within Linux.
How the BIOS decides on the order is a mystery to me. I'm not even sure if it is necessarily the same as the BIOS boot order. In fact, it probably is not the same since you can change the order in which the BIOS lists drives by swapping cables (as evidenced by a change in the names GRUB assigns to drives at boot time), and yet preserve the same BIOS boot order.
Windows, like Linux, may have their own method of ordering and naming drives. By swapping the cables to create a desired order while in Windows does not guarantee that Linux will choose the same ordering. And if Windows is like Linux, then neither order has any relationship to the BIOS order.
Anyway, these are just my speculations. If you find out differently, please let us know!
val_u
June 19th, 2009, 07:53 PM
I know I can be wrong on matters of GRUB, BIOS (and most things in general),
Don't say that, please. You gave me the right sequence to boot Win. So with GRUB I can boot into Win or Ubuntu.
The device.map is not read at boot time, it does not affect how GRUB names the devices at boot time. It only affects how GRUB names the devices when running "sudo grub" from within Linux.But in my previous post I posted results from "sudo grub" from within Ubuntu (from HDD) and content of device.map. The order wasn't the same.
Anyway, these are just my speculations. I could be wrong -- I certainly have been wrong about many things before. If you find out differently, please let us know!That is definitely interesting topic for me. I'm going to study the tread that you pointed to. If I find something interesting, I'll write it here.
That was very useful conversation. Thank you, unutbu for your help.
unutbu
June 19th, 2009, 09:06 PM
But in my previous post I posted results from "sudo grub" from within Ubuntu (from HDD) and content of device.map. The order wasn't the same.
Ah, yes. When I wrote, "It only affects how GRUB names the devices when running "sudo grub" from within Linux." it would have been more accurate to write "It only affects how GRUB names the devices when running "sudo grub --device-map=device.map" from within Linux."
You're post #261 shows this.
That was very useful conversation. Thank you, unutbu for your help.
No problem. Enjoy Ubuntu! :p
lupeatx
December 1st, 2009, 01:28 PM
Copy and paste the following lines above the line
###BEGIN AUTOMAGIC KERNEL LIST
title Windows XP
root (hd1,0)
savedefault
makeactive
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1Ok I'm stuck on this. Is this suppose to be copied into the gedit text editor?
I did that already and saved it. When I go to boot up it load straight to Ubuntu. Now I'm doing this after installing Ubuntu 9.10, Should this still work?
I opened terminal and did the whole sudo fdisk -l and trhis is what I got
Disk /dev/sda: 30.0 GB, 30020272128 bytes
255 heads, 63 sectors/track, 3649 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x7749a9e4
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3493 28057491 83 Linux
/dev/sda2 3494 3649 1253070 5 Extended
/dev/sda5 3494 3649 1253038+ 82 Linux swap / Solaris
By the looks of it, it does not see my 2nd HD. I got everything plugged in correct. Jumpers are correct too.
unutbu
December 1st, 2009, 05:48 PM
lupeatx, unfortunately, I don't know the answer to your problem.
As you pointed out, it looks like this is a hard drive detection problem, not (at least at the moment) a dualboot/GRUB problem.
I suggest you start a new thread so people knowledgable about hard drive detection might see it more quickly.
lupeatx
December 1st, 2009, 06:11 PM
Thanks! I got it to see my 2nd HD but having another issue.
robbielink
December 3rd, 2009, 11:17 AM
First wanted to say many, many thanks to confused57 for starting this excellent thread and to the many others who contributed along the way. I think the answers to just about any scenario are contained in this thread but there's a lot of reading to be done.
Secondly - if you have a Dell machine you will most likely have problems. I don't know if all models have the Dell Utility Partition but the ones that do present a special case (read the thread) - basically your Dell drive boots from hd0,1 - not hd0,0. If you don't pay attention to this you will be frustrated!
Thirdly - It would be nice if everyone could just follow the instructions in the original post and have everything work out fine. For many folks that's the way it is but there are so many other issues that can crop up. The answers are here - don't give up! I spent several hours with a machine that would not boot anything last night and just kept reading and trying things. Even the SuperGrubDisk couldn't help me out (maybe it could've if I understood it better - perhaps a better English translation would help...). In addition to dealing with the Dell Utility Partition, I think I screwed up by not properly uninstalling Wubi, then probably did some stupid things with SuperGrubDisk (a little knowledge can be a dangerous thing) and it's quite possible that my Grub installation on my fresh Ubuntu9.10 install was corrupted. Who knows. At any rate I finally managed to get into the Ubuntu install, reinstalled Grub, ran update-grub (I highly recommend trying that if you're stuck) and made the adjustments to menu.lst to accommodate my DUP and finally success! So if someone as clueless as me can do it you can, too. Be persistent.
Thanks again to the Ubuntu community.
Trinity1976
December 4th, 2009, 06:04 AM
I have no file called 'menu.lst' in my grub directory. Does anyone know if things are different in Karmic?
robbielink
December 5th, 2009, 01:17 AM
I have no file called 'menu.lst' in my grub directory. Does anyone know if things are different in Karmic?
I didn't either - and that was why I wasn't able to boot directly into Ubuntu. I had to reinstall grub and then run "update-grub" which then asked me if I wanted to create a menu.lst which then solved my boot problem (after I edited it to accommodate the Dell Utility Partition on my Windows drive.)
Trinity1976
December 5th, 2009, 06:04 AM
I think the new equivalent is grub.cfg. I tried lots of different combinations of master and slave with my drives and couldn't even get Windows to boot up if I selected the drive manually in the Boot menu.
So I've given up on dual-booting and am going to set up a Virtual Box instead. Windows was on a very old 20GB hard-drive anyway, and it's probably best I get rid of it.
natgab
January 4th, 2010, 01:55 AM
I wanted to add my set-up to the information in this tutorial, and thank Confused57 for making this tutorial.
I was able to use the information here in this thread to make a dual boot set-up of Ubuntu Studio 9.04 and Haiku.
I will describe my HD set-up:
Master SATA 160GB HD / SDc / ubuntu / start-up
Master SATA 80GB HD / SDb / blank / non-formated
Slave IDE 10GB HD / SDa / haiku / 2nd system
Please note that Ubuntu 9.10 and later use GRUB-2 and this is only for Ubuntu 9.04 or older.
Below is my GRUB list.
Notes for GRUB errors:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.28-17-generic
Found kernel: /boot/vmlinuz-2.6.28-11-generic
Found kernel: /boot/vmlinuz-2.6.28-3-rt
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done
__________________________________
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
### timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 3
## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=fad67457-b54e-46e4-8540-613cce54dcdc ro
## default grub root device
## e.g. groot=(hd0,0)
# groot=fad67457-b54e-46e4-8540-613cce54dcdc
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=detect
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options ##
title Ubuntu 9.04, kernel 2.6.28-17-generic
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-17-generic root=UUID=fad67457-b54e-46e4-8540-6$
initrd /boot/initrd.img-2.6.28-17-generic
quiet
title Ubuntu 9.04, kernel 2.6.28-17-generic (recovery mode)
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-17-generic root=UUID=fad67457-b54e-46e4-8540-6$
initrd /boot/initrd.img-2.6.28-17-generic
title Ubuntu 9.04, kernel 2.6.28-11-generic
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=fad67457-b54e-46e4-8540-6$
initrd /boot/initrd.img-2.6.28-11-generic
quiet
title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=fad67457-b54e-46e4-8540-6$
initrd /boot/initrd.img-2.6.28-11-generic
title Ubuntu 9.04, kernel 2.6.28-3-rt
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-3-rt root=UUID=fad67457-b54e-46e4-8540-613cce5$
initrd /boot/initrd.img-2.6.28-3-rt
quiet
title Ubuntu 9.04, kernel 2.6.28-3-rt (recovery mode)
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/vmlinuz-2.6.28-3-rt root=UUID=fad67457-b54e-46e4-8540-613cce5$
initrd /boot/initrd.img-2.6.28-3-rt
title Ubuntu 9.04, memtest86+
uuid fad67457-b54e-46e4-8540-613cce54dcdc
kernel /boot/memtest86+.bin
### END DEBIAN AUTOMAGIC KERNELS LIST
title Haiku OS
rootnoverify (hd2,0)
chainloader +1
Also if this is helpful, here is the info from fdisk:
Disk /dev/sda: 10.2 GB, 10242957312 bytes
255 heads, 63 sectors/track, 1245 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0006bce6
Device Boot Start End Blocks Id System
/dev/sda1 1 1245 10000431 83 Linux
Disk /dev/sdb: 81.9 GB, 81964302336 bytes
255 heads, 63 sectors/track, 9964 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000ed385
Device Boot Start End Blocks Id System
/dev/sdc1 1 18716 150336238+ 83 Linux
/dev/sdc2 18717 19457 5952082+ 5 Extended
/dev/sdc5 18717 19457 5952051 82 Linux swap / Solaris
Hopefully this will help someone and also encourage more linux users to also test Haiku. :lolflag:
trickpat
January 13th, 2010, 11:57 PM
HI. this post has been really helpful so thanks. i've had problems doing this before, and i managed to get it working once so i'm fairly confident i can do it again... but something isn't quite working right.. so i could really use some help. Thanks in advance for any tips :)
Right now, i've got windows 7 installed on a slave 500 Gig IDE drive and ubuntu 9.10 freshly installed on a 250 Gig Sata drive. I installed them both seperately with only one hard drive connected at a time. when i boot with both hard drives connected it's not giving me the option to boot either, it just automatically boots into ubuntu. which is great because it means i can just go into terminal and change the boot bios right? so here's my drive configureation when i type :
sudo fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x283f283e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 30027 241191846 83 Linux
/dev/sda2 30028 30401 3004155 5 Extended
/dev/sda5 30028 30401 3004123+ 82 Linux swap / Solaris
Disk /dev/sdb: 500.1 GB, 500107862016 bytes
16 heads, 63 sectors/track, 969021 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x48cb4d3f
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 969018 488385040+ 7 HPFS/NTFS
patrick@patrick-desktop:~$
So i think i just need to tweek the line that i put in the edited menu.lst
gksudo gedit /boot/grub/menu.lst
title Windows XP Professional
root (hd1,0)
savedefault
makeactive
chainloader +1
map (hd0) (hd1)
map (hd1) (hd0)
replace windows xp professional with Windows 7
and change the Hd0 HD 1 Lines but.. i cant figure what i need to change. any tips? or anything else i need to change? i tried putting it in unchanged just the way i pasted it there and i thought it would work.. but it didn't seem to do anything. I used to have XP and ubuntu running like this on 2 hard drives and it worked great so i hope i can figure this out. Thanks for your time!
ssican
January 16th, 2010, 05:41 AM
TIP
-BOOTING XP ON A NON-FIRST HARD DRIVE-
SOURCE:
KubuntuForums.net
GRUB 2 A Guide for Users
AUTHOR: Qqmike
http://kubuntuforums.net/forums/index.php?topic=3106368.0
On Reply #1 -POST 2-
http://kubuntuforums.net/forums/index.php?topic=3106368.msg195829#msg195829
Qqmike Recommend:
- Run First: grub install
sudo grub-install
before running
sudo grub-mkconfig -o /boot/grub/grub.cfg
(Qqmike wrote:
grub-mkconfig Detecting other OSs
grub-mkconfig automatically runs os-prober to detect other OSs on your PC (assuming os-prober is installed, which it will be in any normal installation).
grub-mkconfig: Is grub.cfg in sync with core.img?
=> Run first: grub-install
To be sure you get the best and the correct grub.cfg file, especially if there's been a change/update to core.img, it would be safe to run
sudo grub-install
before running
sudo grub-mkconfig -o /boot/grub/grub.cfg
XP on a non-first hard drive: (hdx,y), x > 1
Qqmike recommend:
See the following section titled "Booting XP on a non-first hard drive: The drivemap command in GRUB 2."
=> => Fact is, you might be able to use the GRUB 2 utility grub-mkconfig or grub-install to do this work for you: they might detect Windows properly and adjust for Windows being on a non-first HD (by implementing the drivemap commands automatically). (For the commands grub-mkconfig and grub-install, see Notes about some of the new GRUB 2 commands (in Reply #1 above); also see SECTION 3: Fixing Things)
Booting XP on a non-first hard drive The drivemap command in GRUB 2
Qqmike wrote: "I will present you with safe options that will not harm your GRUB 2 or dual-booting setup.
For a more compact Method 2 and for technical notes and other useful details about how drivemap works, see Reply #17. (Later, Reply # 17 may be incorporated here.)
The Quick-and-Dirty Solution
Method 1
To boot Windows XP installed to (hd1,1), use the following menuentry (in a script you write as a text file (and make executable) in the folder /etc/grub.d):
# Method 1 -- a safe, sure way to do it
# This method applies to Windows and to FreeDOS
# Windows XP on sdb1 (= (hd1,1)
menuentry “Windows XP on sdb1, by chainloader” {
drivemap (hd0) (hd1)
drivemap (hd1) (hd0)
set root=(hd0)
chainloader (hd1,1)+1 }
=> The drivemap command in GRUB 2 replaces the map command in GRUB Legacy.
=> That's all you need to know to make your grub.cfg work.
=> => Fact is, you might be able to use the GRUB 2 utility grub-mkconfig or grub-install to do this work for you: they might detect Windows properly and adjust for Windows being on a non-first HD (by implementing the drivemap commands automatically). (For the commands grub-mkconfig and grub-install, see Notes about some of the new GRUB 2 commands (in Reply #1 above); also see SECTION 3: Fixing Things"
EDIT 1
USING -sudo grub-install- Herman recommend to specify the Disk you wish to Install Grub:
sudo grub-install /dev/sda
Where: /dev/sda is the disk you wish to install GRUB to, (boot.img to first hard disk MBR), otherwise use '/dev/sdb' for second hard disk or '/dev/sdc' for third hard disk
How to Install, update and repair GRUB:
http://members.iinet.net/~herman546/p20/GRUB2%20Bash%20Commands.html#install_update_and_re pair
betterspud
March 23rd, 2010, 07:59 AM
Ok. I am a complete noob with linux systems and have no real clue what I'm doing.
Have read through many posts about changing Grub and am having no luck.
Whenever I try to save an edited version of grub.cfg I get a 'could not save the file' error because it is read only and I do not have permission. I thought that using sudo would allow me to save it?
What am I doing wrong?
EDIT: Just discovered that on 9.10, it uses Grub2.0 and that you CANNOT edit grub.cfg, but have to change the default within /etc/default/grub instead.
Have just installed startup manager from the package list and am configured through that. Hopefully, it will do the job...
eljefe
April 19th, 2010, 04:27 AM
I havent had any luck here with my dual HD booting, as per this tutorial:
http://ubuntu-georgia.org/installing_ubuntu_and_windows_xp_on_separate_drive s#References
I got the required details into the grub menu and it all comes up great, the only problem is that when I hit the "Windows" option it says:
Error 21: Selected disc does not exist
Press any key to continue.....
When I do this Mint 7 loads as expected.
I have the HD1 cable plugged into the Linux HD and the HD2 cable plugged into the XP HD. The XP install was acatually done on this box, so I know it goes.
Normally in this machine HD1 cable goes to the XP HD, and the Mint HD is not there at all.
Both HDs were set with cable select positions for the jumpers, which is how the XP drive was installed too.
I then dicked about with the Jumpers.
Cable select for both HD's (Error 21)
Mint on cable select, Windows on slave (Error 21)
Mint on master, window on slave (No grub menu, just Error 21)
Has anyone got any clues on how to trouble shoot from here?
My bios says:
SATA Primary drive OFF
SATA Seconday drive OFF
Primary Master drive HARD DRIVE
Primary Slave drive OFF
Secondary master drive cdrom device
Secondsary slave drive OFF
IDE drive UDMA ON
This is for my daughter. I want her to keep using Linux but want to have the windows boot as a last resort.
confused57
April 19th, 2010, 11:04 AM
Hi eljefe,
You might see if there is an option in your bios to turn on your primary slave controller:
SATA Primary drive OFF
SATA Seconday drive OFF
Primary Master drive HARD DRIVE
Primary Slave drive OFF
Secondary master drive cdrom device
Secondsary slave drive OFF
I had a Dimension 4550, which would show grub error 21 if the primary slave controller was set to off...had to set it to "auto" to get Windows to boot properly.
Here's an excellent explanation of error 21 & possible causes:
http://members.iinet.net.au/~herman546/p15.html#21
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.