2

I had a VDI (VirtualBox Virtual Disk Image) with Ubuntu 11.10 (64bit, I think) installed on it. Earlier, while running a GParted live CD on my Virtual Machine to erase the partition table of another Disk, I ended up inadvertently removing the partition table of my Ubuntu VDI instead of the other disk's (I know, it was stupid of me not to be 100% sure of which disk I was working on before proceeding, but I had done it so many times before that I did not even think of checking).

After gathering my bearings, I tried to look for a way to recover from the damage. I managed to recover my /dev/sda1 partition and the swap partition (even though it was now out of the extended partition it was into before) using TestDisk.

The problem is that now, when I boot into the VDI, I just get a black screen with no prompts nor any signs of life.

I tried to install TestDisk's MBR onto the disk and now when I ran the VM it would display TestDisk's MBR prompt. When I told it to boot into my Ubuntu partition, though, it kept displaying that black screen.

Is there a way to overcome this situation? I think the problem might be lying inside the partition's boot sector (and now I'll also have to reinstall GRUB or something over the MBR).


EDIT: Here's some additional information.

fdisk:

user@debian:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 75.0 GB, 75019321344 bytes
255 heads, 63 sectors/track, 9120 cylinders, total 146522112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/Physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e56c7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   129746943    64872448   83  Linux
/dev/sda2       129746944   146518015     8385536    5  Extended
/dev/sda5       129748992   146518015     8384512   82  Linux swap / Solaris

I'm not completely sure about this (and please excuse my ignorance if I'm wrong), but I think it might be an anomaly that /dev/sda1 starts at 2048. Shouldn't it start at 0?

2
  • The MBR starts at 0, so sda1 must start somwhat later. Use hexdump -C /dev/sda | more to see what's between the MBR and sda1.
    – ott--
    May 29, 2012 at 19:42
  • I can't discern much from it seeing it that way, but I can see that there's a gap (filled with NOPs) between 0x40 (included) and 0x70 (not included), and another one between 0x200 and 0x600. Here's a screenshot of the dump
    – kettlepot
    May 29, 2012 at 20:17

1 Answer 1

3

I have found a solution to this problem. Here are the steps I've taken for future reference and in the hope that it might help those who encounter the same problem.

  • I downloaded a Live CD version of Ubuntu 11.10 (make sure that you download the amd64 Live CD if your system is 64 bit).
  • I booted into the Live CD, asked to try Ubuntu and opened a new terminal window.
  • Loosely following the guide published here, I ran the following commands:
    • sudo mount /dev/sda1 /mnt
    • sudo mount --bind /dev /mnt/dev
    • sudo mount --bind /proc /mnt/proc
    • sudo mount --bind /etc /mnt/etc
    • sudo mount --bind /sys /mnt/sys
      (some of these might be redundant but I found that some programs would give out some errors if these weren't run)
    • sudo chroot /mnt
  • When I was in as root, I ran:
    grub-install /dev/sda.

The last command said everything was okay and working. I rebooted the Virtual Machine and I was back into my Ubuntu install, as if nothing ever happened.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .