[CentOS] Analyzing the MBR

Thu Jun 5 12:07:03 UTC 2014
David Both <dboth at millennium-technology.com>

The dd command shows you **exactly** what is in the MBR and, if you want, the 
following sectors. But the following sectors are not particularly relevant to 
boot. THe MBR contains the boot record and the partition table. There is not 
room for anything else. But your problem is not with the MBR so the solution 
does not lie there.

Although you have already reinstalled, you might have recovered by changing the 
boot order of the hard disks in the BIOS configuration for your computer. Most 
computers have that capability these days. You might also have booted to a 
recovery disk (most install DVDs have recovery mode as a menu option) and noted 
the sequence in which the drives were recognized by BIOS by using the dmesg 
command. Perhaps you plugged the drives back into different locations on the 
bus. Are they PATA or SATA?

As far as what appears to be your original problem, discovering information 
about a hard drive, the smartctl command can give you plenty of information 
about a drive even if it is not in the database. You just need to use the -a or 
-x options. You could also have used fdisk -l /dev/<driveID> to display the 
basic capacity information about the drive. And the dmesg command can also give 
you information about your hard drives and the way the kernel sees them before 
you need to use rescue mode.

I hope this helps a bit for future issues.

On 06/05/2014 07:01 AM, Timothy Murphy wrote:
> Is there any tool for analysing the MBR on a computer?
> I know one can just dd it and see roughly what it contains.
> But surely one should be able to work out the exact content
> of the MBR and the neighbouring sectors read at boot time?
> I had a difficult day, probably due to my ignorance,
> which would have been solved at once by such a tool.
> I had taken one of three hard disks out of my home server
> (to see exactly what it was, as smartctl said it was not
> in its database) and this had the effect of altering
> the order of the disks in the BIOS, preventing re-booting.
> It was only after I had re-installed CentOS in a spare partition
> that I realized what had happened.
> Incidentally, before this I had tried
> what I take to be the standard way of solving this problem,
> by running a CentOS Live USB stick, mounting the root partition
> and trying to chroot to this, but that did not work -
> chroot on the stick would not run,
> and neither would chroot on the disk.
> I'm wondering if there was some other method I could have tried?
> For example, I tried running a Fedora netinstall USB stick,
> which has a "Try to repair the system" option in Troubleshooting.
> This saw the system OK, but did not have grub-install on it.
> As far as I could see, none of the CentOS install disks
> has such a tool on it?
> -- 
> *********************************************************
> David P. Both, RHCE
> Millennium Technology Consulting LLC
> 919-389-8678
> dboth at millennium-technology.com
> www.millennium-technology.com
> www.databook.bz - Home of the DataBook for Linux
> DataBook is a Registered Trademark of David Both
> *********************************************************
> This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately.