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.
When I run the 'fdisk /dev/sda' command, the console displays:
"Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel. Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable."
When I run grub and enter 'find /grub/stage1', the console displays "Error 15: File not found"
I suspect that when I power the system down, it will not reboot. I can 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?
The system is completely backed up and can be restored if necessary, but I prefer a quick and simple solution, if possible.
Any ideas? Thanks
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
On 1/5/2012 11:20 AM, m.roth@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@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
Billy Davis wrote:
On 1/5/2012 11:20 AM, m.roth@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
<tail o' woe elided>
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.
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.
Good deal!
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.
Best of luck, and let us know how things turn out.
If things go south, there *are* tools that will let you scan a raw disk, and you could look for the superblock or the first dup, then calculate where the fs & partition should start, but that would be *real* work.
Thanks again for your input.
As I said, hope it works.
mark
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of m.roth@5-cent.us Sent: Thursday, January 05, 2012 15:33 To: CentOS mailing list Subject: Re: [CentOS] Corrupt mbr and disk directory map
Billy Davis wrote:
On 1/5/2012 11:20 AM, m.roth@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
<tail o' woe elided>
<SNIP>
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.
Best of luck, and let us know how things turn out.
If things go south, there *are* tools that will let you scan a raw disk, and you could look for the superblock or the first dup, then calculate where the fs & partition should start, but that would be *real* work.
The OP might want to look at the archives of this list for the somewhat recent "data recovery" thread before rebooting. I thought Lamar Owen's 9/23/2011 15:35 post was particularly good, because it mentioned some of the tools and processes.
And as Mark said... I hope it works.