[CentOS] Corrupt mbr and disk directory map

Thu Jan 5 16:20:34 UTC 2012
m.roth at 5-cent.us <m.roth at 5-cent.us>

Billy Davis wrote:
> We are running Centos 5.6.  All was fine until yesterday.  I attempted
> to tar a 14KB work file to a USB floppy  (/dev/sdb) for transport to
> another server.  Unfortunately, I keyed in 'tar cvf /dev/sda filename'
> instead of 'tar cvf /dev/sdb filename'.   /dev/sda is our main
> (boot/root/apps) scsi hard drive.   I realized my mistake, but it was
> too late.  The system is still powered up and running, but I am sure
> that I have overlaid (and trashed) the mbr and the disk directory map.
<snip>
> I suspect that when I power the system down, it will not reboot.  I can

You have that right.

> reinstall mbr and grub, but I don't have the original partition table
> start/end values.  Since the system is still running, it seems that the
> partition table must still be available to it from somewhere.
>
> Is there any way to easily restore the partition table?

Easily? No (other than the grub-install /dev/sda part).

Sorry about your problem, but I appreciate the question: it led me to
<http://www.cromwell-intl.com/unix/linux-kernel-details.html>, a fair bit
of which was quite familiar, and other bits weren't. For example, cat
/proc/partitions might give you a serious bit of the information you're
looking for.

Hope that helps.

       mark