1

I think I have just made the worst mistake one can made - please help me recovering from it.

A guy from another room came over said to me this is a BIOS update (or something similar) for the new servers we just bought. Would you mind making an image and dd into the floppy so I can use it for the server installation.

I was in such pressure doing 5 things in parallel so I said okay, and he pointed out to the IBM readme file.

I simply followed the instructions there and did the mounting and the dd line. As a result, rebooting the machine few minutes later brought up boot failure error message.

I started the machine with the ubuntu live cdrom and noticed that during new installation attempts, when it gets to the partitioning part, no hard-drive is presented.

Is there a safe way rolling back this stupid action?

3
  • to clarify: is it correct that you have given up on recovering any data from the hard disk and just want to re-install an os?
    – user1686
    Nov 25, 2009 at 15:30
  • @hop - data is the most critical part in this case Nov 25, 2009 at 16:44
  • then you shouldn't write "during new installation attempts!" it gives the impression that you want to attempt a new installation, you know?
    – user1686
    Nov 25, 2009 at 17:40

5 Answers 5

7

Ok, first thing first: DO NOT REBOOT. What you need is

  • to reinstall the master boot record (basically, relaunch grub or lilo)
  • rebuild the partition table using tools such as gpart (which will scan your hd and try to determine boundaries of primary partitions, not logical ones)
  • since you erased 1.4MB, what I'd suggest at this point is either try to determine what was in the first meg or so and copy it back (might just be the linux kernel image..? or /etc/init?), or build a new root partition. I sincerely hope you have more than one partition.

if you have everything on a single partition, make a backup of everything important (home, /etc) and be ready for a complete reinstall.

ps: welcome to the club :)

1
  • not rebooting is irrelevant, as I said, I rebooted already. I will try to use gpart and other tools hoping one of them will rescue. thanks for your answer though Nov 25, 2009 at 16:45
4

The first thing I would recommend after an event like this is to take a disk image with dd. Forgive the irony, this really is the best next step. To help you get this right in the future, make sure you use /dev/sda as the if= (Input File) and a file an some other working partition for the of= (output file).

The idea is that once you have this image, you can work with that image, or you have the image as a back up. Trying to fixing first without doing this runs the risk of causing further damage.

One you have done that, I would recommend testdisk as well, you can specify the disk image you created as an argument to test disk.

1
  • if not for the fact that /dev/sda does not exist that could have been a great idea. Nov 26, 2009 at 3:53
1

You can try the utility testdisk, it searches for partitions and tries to recover them.

It is available in the repositories, if you are running the ubuntu-live cdrom you can install it in memory.

4
  • testdisk sees only the cdrom this is what i get Select a media (use Arrow keys, then press Enter): Disk /dev/sr0 - 723 MB / 689 MiB (RO) - Optiarc DVD+-RW AD-7200S Nov 25, 2009 at 15:21
  • Do you still see the device in /dev? If you do, give the device as a parameter to testdisk. If not, there's something else going on. Is it still visible in the BIOS? Nov 25, 2009 at 15:24
  • well BIOS said SATA crap not present. Could it be that it killed the hard drive so hard that it is not presented even in the BIOS? Does this make sense at all? I am all lost along with my data Nov 26, 2009 at 4:14
  • Well, I've never heard of it that overwriting the first sectors in a satadisk makes it dissappear from the BIOS as well. Perhaps you can try to attach it to another host? And if this is a server, are you sure that it isn't a SCSI disk that should get detected later on in the boot process by the BIOS of your SCSI controller? Check for things like 'press ctrl-something to do scsi config' during the boot process.. Nov 26, 2009 at 6:45
1

First of all, before you make any additional changes to the disk, do as others have suggested here and pull a full disk image for backups. Do this before you risk anything else.

dd if=/dev/sda of=/dir/for/backup/disk-sda.img block=8M

After you have the backup, it's possible you only blew away the partition information and bootloader stuff. I don't honestly remember the low-level details of a disk offhand (such as whether you overwrote actual data, or just partition/bootloader), but do you have the exact partition layout that the disk was previously using? If so, restoring that disk partitioning could get you moving in the right direction. At the very least, if there are multiple partitions on the disk, that will let you access all but (potentially) the first.

Note that this needs to be an exact partition layout. The kind you get from sfdisk is ideal:

$ sudo sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=   144522, Id=de
/dev/sda2 : start=   144585, size=   385560, Id=fd, bootable
/dev/sda3 : start=   530145, size=140633010, Id=fd
/dev/sda4 : start=141163155, size=171333225, Id=fd

If you have another machine that is configured identically, you can likely pull this information from there (assuming it has identical sized disks and is using an identical partition latyout). I've had success doing this in the past when someone overwrote the partition table.

If you don't have or can't find the partition layout, there are some tools that will attempt to find partitions by scanning the disk.

1
  • The fdisk part was to show you an example of the low-level partition layout data you need. If you have or can get this information, you can use it to recreate your old partition layout. If you have another machine with the same identical partition layout, you can pull the partition information from that one and use it as input to repartition the mangled disk. Nov 25, 2009 at 17:01
1

Basically, all answers given here are good and pointing to the right direction (voted all up).

Unfortunately, in my case, it seems like on top of this logical deletion, the hard drive itself crashed physically. That is according to the lab I took it this morning.

They said that the reboot attempts and all those plug/unplug the power cable the IT guy did right after, probably caused this damage to the disk.

This explain why /dev/sda was not available for all partitioning and recovery tools I've tried.

Thank you all for your time and efforts.

1
  • too bad. sorry about that. Never heard of such a thing, but I guess the IT person really exaggerated in pulling the power plug. so plugging the drive into a linux box and dmesg 'ing it doesn't show a thing? odd nevertheless. sorry.
    – lorenzog
    Nov 26, 2009 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.