I removed an ATA drive (/home) for a new SATA and my system would not boot. I'm guessing that it put the MBR on that drive instead of the drive that holds the / partition. What's the best way confirm where the MBR resides and, after I verify that's my problem, how I can move (or make a copy) onto a different drive?
Thanks, Scott
Just in case this makes any difference...
# cat /etc/redhat-release CentOS release 4.6 (Final)
Thanks, Scott
On Thu, May 22, 2008 at 11:06 PM, Scott Moseman scmoseman@gmail.com wrote:
I removed an ATA drive (/home) for a new SATA and my system would not boot. I'm guessing that it put the MBR on that drive instead of the drive that holds the / partition. What's the best way confirm where the MBR resides and, after I verify that's my problem, how I can move (or make a copy) onto a different drive?
Thanks, Scott
Scott Moseman wrote:
I removed an ATA drive (/home) for a new SATA and my system would not boot. I'm guessing that it put the MBR on that drive instead of the drive that holds the / partition. What's the best way confirm where the MBR resides and, after I verify that's my problem, how I can move (or make a copy) onto a different drive?
The BIOS determines which disk (the first) will be chosen to boot from. Sometimes hitting F12 or some other key gives you a menu to choose from. I have seen occasions were the bios was confused on what the "default" first disk was. Removing the last disk, booting, adding the disk would than help.
To make a plain bootsector copy: dd if=/dev/sda of=/dev/sdb bs=512 count=1
But that the fist step of the boot loader. Next it will try to load the grub menu etc. from some disk (need not be the same disk, but mostly this disk contains a small (100MB) partition that holds these files and the kernel and ramdisk images. After boot this partition is normally mounted under /boot (for easy maintenance). So just copying the boot sector gives you only a grub prompt and then it stops.
So try boot with a rescues disk (or LiveCD) so that you can study your disks.
To install grub after booting from a resuce CD, you can use:
grub root (hd0,1) # press tab for command completion setup (hd0)
With all these examples you need to verify of course which disks/partition (sda/sdb etc) you need to choose. One way to search is to enter grub and use the find command with command completion:
Probing devices to guess BIOS drives. This may take a long time. GNU GRUB version 0.95 (640K lower / 3072K upper memory)
[ 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> find (hd<TAB> Possible disks are: hd0 hd1 hd2 hd3
grub> find (hd0,(TAB> Possible partitions are: Partition num: 0, Filesystem type is ext2fs, partition type 0x83 Partition num: 1, Filesystem type unknown, partition type 0xfd
grub> find (hd0,0)/<TAB> Possible files are: lost+found vmlinuz-2.6.21-1.3194.fc7 grub System.map-2.6.21-1.3194.fc7 config-2.6.21-1 .3194.fc7 initrd-2.6.21-1.3194.fc7.img config-2.6.9-55.0.6.ELsmp initrd-2.6.9-55.0.6.ELsmp.img System.map-2 .6.9-55.0.6.ELsmp vmlinuz-2.6.9-55.0.6.ELsmp initrd-2.6.9-55.0.6.ELsmp.img_vg_new initrd-2.6.9-55.0.6.ELsmp .img_noraid
grub> find (hd0,0)/
Theo
The BIOS determines which disk (the first) will be chosen to boot from.
I have no problems configuring the boot order in the BIOS.
I must have the MBR on /dev/hdc (which is being removed). The /boot partition is on /dev/sda (where I want to move MBR).
To make a plain bootsector copy: dd if=/dev/sda of=/dev/sdb bs=512 count=1
sda = old MBR source and sdb = new MBR source, I assume? So, in my instance, I'm going to want to run it in this syntax:
dd if=/dev/hdc of=/dev/sda bs=512 count=1
I'm assuming the first 512 bytes are allocated purely for MBR and won't hold any data that could be overwritten? Would that be true?
grub root (hd0,1) # press tab for command completion setup (hd0)
Do I need to move the MBR, remove the old drive, and reboot from a LiveCD in order to have a reconfigure of grub correctly see which drive it should find to boot from? Or can I do this before taking the system down for the drive removal?
Thanks, Scott
I also do not see an CentOS 4.x x86_64 Live CD; only i386. Is it not really going to matter, 64b vs 32b, when using that?
Thanks, Scott
Do I need to move the MBR, remove the old drive, and reboot from a LiveCD in order to have a reconfigure of grub correctly see which drive it should find to boot from? Or can I do this before taking the system down for the drive removal?
I copied over the MBR from hdc to sda. I found a 4.4 LiveCD, but apparently its damaged so it wouldn't boot. I attempted to put everything back and when I rebooted it went into a GRUB screen instead of a normal boot. I had no idea how to get it to boot from there, so instead of taking the time to figure it out, I decided it was time to make the plunge to CentOS 5. So I'm now on CentOS 5 and my old /home hard drive is completely history. :)
Thanks, Scott
On Fri, May 23, 2008 at 10:49 AM, Scott Moseman scmoseman@gmail.com wrote:
I also do not see an CentOS 4.x x86_64 Live CD; only i386. Is it not really going to matter, 64b vs 32b, when using that?
Thanks, Scott
Do I need to move the MBR, remove the old drive, and reboot from a LiveCD in order to have a reconfigure of grub correctly see which drive it should find to boot from? Or can I do this before taking the system down for the drive removal?
Scott Moseman wrote:
I copied over the MBR from hdc to sda. I found a 4.4 LiveCD, but apparently its damaged so it wouldn't boot. I attempted to put everything back and when I rebooted it went into a GRUB screen instead of a normal boot. I had no idea how to get it to boot from there, so instead of taking the time to figure it out, I decided it was time to make the plunge to CentOS 5. So I'm now on CentOS 5 and my old /home hard drive is completely history. :)
And you happy with this?
I also do not see an CentOS 4.x x86_64 Live CD; only i386. Is it not really going to matter, 64b vs 32b, when using that?
Doesn't matter for grub. Grub can load any operating system. You can even install grub while running Windows XP (tried it once).
Do I need to move the MBR, remove the old drive, and reboot from a LiveCD in order to have a reconfigure of grub correctly see which drive it should find to boot from? Or can I do this before taking the system down for the drive removal?
In principle this does not matter. Only the entries in grub.conf which make up the menu need to be changed. The menu entries will contain entries like "root (hd1,0)" which you need to change to "root (hd0,0)" if you have only one disk in your system instead of two. Once grub starts correctly, you can edit the menu entries as well. Just press the 'e' key and scroll to the line that is incorrect and change it until the system boots correctly. Permanent settings can be saved after your boot in /boot/grub/grub.conf.
Anyway you are now happy with Centos5?
Cheers, Theo
I was wanting to upgrade (reinstall) but never had a good excuse. I was going to spend more time fiddling around with the MBR and Grub settings than I was going to kill doing a OS reinstall. All of my data was on a separate /home disk, so I just slapped on the new OS, configured a couple services and the box was back online in no time.
Thanks for your help, Scott
On Mon, May 26, 2008 at 2:46 AM, Theo Band theo.band@greenpeak.com wrote:
Anyway you are now happy with Centos5?
Scott Moseman wrote:
I copied over the MBR from hdc to sda. I found a 4.4 LiveCD, but apparently its damaged so it wouldn't boot. I attempted to put everything back and when I rebooted it went into a GRUB screen instead of a normal boot. I had no idea how to get it to boot from there, so instead of taking the time to figure it out, I decided it was time to make the plunge to CentOS 5. So I'm now on CentOS 5 and my old /home hard drive is completely history. :)
You likely overwrote your PT. See my other post. If you can recover your PT, you'll likely get your data back.
Before fiddling like this always
(1) make a complete backup of your system (2) display and archive your PTs using fdisk or similar (3) make complete copies of your MBRs on each disc, and BRs for each partition.
Mike
Scott Moseman wrote:
The BIOS determines which disk (the first) will be chosen to boot from.
I have no problems configuring the boot order in the BIOS.
I must have the MBR on /dev/hdc (which is being removed). The /boot partition is on /dev/sda (where I want to move MBR).
To make a plain bootsector copy: dd if=/dev/sda of=/dev/sdb bs=512 count=1
sda = old MBR source and sdb = new MBR source, I assume? So, in my instance, I'm going to want to run it in this syntax:
dd if=/dev/hdc of=/dev/sda bs=512 count=1
I'm assuming the first 512 bytes are allocated purely for MBR and won't hold any data that could be overwritten? Would that be true?
It is not guaranteed to be true. Every disc has an MBR. The MBR has three fields (depending on how one counts, some say two). One field is the code area, another is the Partition Table (PT) and the third is the Boot Marker (some include this in the PT). You don't want to copy the PT from one disc to another. Copying all 512 bytes will overwrite the PT.
Mike