bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

writing MBRs & disk numbering


From: Wojtek SWIATEK
Subject: writing MBRs & disk numbering
Date: Tue, 18 Aug 2009 17:44:41 +0200

Greetings everyone,

I have a hard time understanding some points around disk numbering in the scenario I have.

Background: The setup is a laptop with an internal disk (/dev/sda) and an external USB drive (/dev/sdb). The OS (Linux) is installed on the USB drive, the internal one has a working Linux installation. The MBR is on the external disk (/dev/sdb). BIOS is set up to boot form internal first, then USB. The internal disk has no MBR but, again, a working OS otherwise (which is not used now).
The part where it becomes complicated is that the video card on the laptop does not work well (you can actually see something only in BIOS, it is just trash afterwards). The extra complication is that I cannot remove the internal disk drive (to attach it to another system). This mean that I have limited capabilities to play with the console during the boot and afterwards 5I access the system via ssh when it is up)
Whenever I mention "OS" this is a Linux Fedora 10.

Sorry if this sounds like a McGyver episode but I have no choice.

The current setup (= boot from USB) works fine and the OS (again, on the USB drive) works fine as well.
My goal is to get rid of this USB drive by moving the OS to the internal drive. To cut a very long and painful story short -- the internal drive has now a working OS in place, what remains is to write the MBR. The internal drive has one partition (/dev/sda1) with a /boot copied form the external one and hopefully adapted to the new environment:

--- /boot/grub/grub.conf of the internal drive ---
default=0
timeout=0
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.5-117.fc10.i686)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.27.5-117.fc10.i686 ro root=/dev/sda1 rhgb quiet
        initrd /boot/initrd-2.6.27.5-117.fc10.i686.img
---

My question is the following: what exactly should I do to write the MBR to /dev/hda1 using the config above. In practical terms I can access it by mounting /dev/sda1 at /mnt (and then access the config file via /mnt/boot/grub/grub.conf if needed).
Specifically, is (hd0) currently pointing to the internal or external drive? In other words when I issue a

# grub  --config-file=/mnt/boot/grub/grub.conf
grub> root(hd0,0)
grub> setup (hd0)

will I be writing the MBR with the new (adapted to a boot from the internal drive sda) config to the internal drive?

I would like, obviously, to avoid writing the MBR on my external drive which has a working MBR.

Thanks a lot for any pointers, I would like to avoid spending another 2 sleepless nights :)

Aside of the problem, one thing which makes me wonder a lot is that the current config (on the external drive) refers to (hd0) and at the same time the device map claims that hd0 is /dev/sda (so the internal drive):

--- grub.conf in the current, working /boot on the external USB drive)
# 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/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=0
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.5-117.fc10.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=32faed91-ab12-4d81-9
173-246be6a11391 rhgb quiet
        initrd /initrd-2.6.27.5-117.fc10.i686.img
---

--- device.map on the external USB drive in /boot/grub --
# this device map was generated by anaconda
(hd0)     /dev/sda
---

mount shows on the current setup that:
/dev/sdb1 on /boot type ext3 (rw)
(which is OK).

My wild guess is that the device map is not being used :)

Thanks!
Wojtek




reply via email to

[Prev in Thread] Current Thread [Next in Thread]