[CentOS] Corrupt mbr and disk directory map

Thu Jan 5 20:21:32 UTC 2012
Billy Davis <bdavis at cds-corp.com>

On 1/5/2012 11:20 AM, m.roth at 5-cent.us wrote:
> 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
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
>
Thanks Mark.  The cat command provided the lost partition information.  
I used that information with fdisk to restore the partition map.  The 
fdisk partition map is now identical to the cat partition information.

Next, I reinstalled grub.  All seems normal now, at least until I 
shutdown and reboot.  I'll wait until the weekend to do that, just in 
case I still have to do a disk restore for some reason.

Thanks again for your input.
Billy