10

The setup in question is as follows: Windows 7 64bit host running VirtualBox. The guest machine is running Windows XP 32bit.

After a power failure on the host box, the guest machine cannot boot and complains that

inconsistency between grain table and backup grain table

Any help to boot the guest machine without reinstalling it appreciated.

PS: What is a grain table anyway?

adamo
  • 6,925
  • 3
  • 30
  • 58

5 Answers5

13

VMware has a tool called vmware-vdiskmanager located in "/Applications/VMware Fusion.app/Contents/Library/" and symlinked to /usr/local/bin when installed. You can use this tool to repair VirtualBox VMDK disks as well. It saved me a couple of times already.

Installation

a. You can install vmware-fusion (requires macOS Catalina; use vmware-fusion10 for older macOS versions)

brew install vmware-fusion

b. Or you can download the vmware-vdiskmanager utility directly from Attachments section at the bottom of this page:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1023856

Usage

vmware-vdiskmanager -R <your_disk>.vmdk

Invoking without parameters gives help usage:

Usage: vmware-vdiskmanager OPTIONS <disk-name> | <mount-point>
Offline disk manipulation utility
...
     -R                   : check a sparse virtual disk for consistency and attempt
                            to repair any errors.
...
itg-dave
  • 3
  • 4
mens
  • 131
  • 1
  • 2
  • 1
    The name of the tool has a v in it: "vmware-vdiskmanager". I tried to edit the answer, but it only added 2 characters, and edits have to be at least 6? :) – Ned Batchelder Mar 15 '15 at 10:44
  • This worked great, it just saved me after my Mac crashed and left a vagrant virtualbox in a dirty state. Thank you! – Fred Nov 20 '15 at 18:13
  • 1
    I'm getting "no errors were found on the virtual disk" after running the repair command even though I have the same grain table error. Any other ideas fro solving this? – user95227 Sep 21 '16 at 14:19
  • Awesome, thanks! Was able to fix corrupted appliance file (*.vmdk) after forced poweroff. – Matt Borja Oct 18 '16 at 19:41
  • I moved my vms from Linux to MacOs, updated Ids and all of my VMs does the same error. I'm always getting the _inconsistency between grain table and backup grain table_. I tried the tool, but it outputs _The virtual disk, '/path/to/virtualbox_disk.vmdk', is corrupted and cannot be repaired._. – GabLeRoux Mar 21 '17 at 23:31
  • 1
    Last night, a ServerFault answer saved my life! – Spencer Williams Jul 14 '17 at 21:55
  • This should be the accepted answer. To give more insight VirtualBox prefers VDI files and has a `vbox-img repair` option but doesn't have extensive functionality for VMDK files which is what VMWare prefers hence why their tool has the better ability to fix issues. – Robert Brisita Jan 22 '19 at 17:30
4

Can't really help, but I found what the grain tables are here: http://www.vmware.com/support/developer/vddk/VirtualDiskAPIprogramming.pdf (page 16)

Like the user mailq says, looks like your virtual drive is broken. Maybe check the vmdkck tool (on this page http://datto.org/projects/vmdk-tools ) to double check it's broken?

  • Thank you too. I accepted your answer because it provided links to locate what a grain table actually is. One can request the virtual disk format specification here http://www.vmware.com/technical-resources/interfaces/vmdk.html – adamo Oct 24 '11 at 14:47
2

Your virtual hard drive is broken. Grain tables are some internal stuff of virtualization environments.

Googling for the exact term reveals that there are not many possibilities to recover: https://forums.virtualbox.org/viewtopic.php?f=6&t=40049

mailq
  • 17,023
  • 2
  • 37
  • 69
  • Thank you for the prompt reply. I had googled prior to asking at SF. I asked hoping for a long-shot answer not already covered by the VirtualBox fora. – adamo Oct 24 '11 at 14:21
2

I used CloneVDI to solve this problem. I made a clone and the new file works very well.

Mr Shark
  • 346
  • 3
  • 10
Valguimar
  • 29
  • 1
1

I had this error after moving my ~/VirtualBox\ VMs from Linux to MacOS. I tried @mens solution using vmware-vdiskmanager, but it failed for me.

During my migration from linux to MacOS, I added all of the *.vbox files back into Virtualbox and they all failed to boot with the same error (using vagrant):

There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "<UUID 1>", "--type", "headless"]

Stderr: VBoxManage: error: Could not open the medium '/path/to/box-disk1.vmdk'.
VBoxManage: error: VMDK: inconsistency between grain table and backup grain table in '/path/to/box-disk1.vmdk' (VERR_VD_VMDK_INVALID_HEADER).
VBoxManage: error: VD: error VERR_VD_VMDK_INVALID_HEADER opening image file '/path/to/box-disk1.vmdk' (VERR_VD_VMDK_INVALID_HEADER)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MediumWrap, interface IMedium

I verified that the data transfered correctly, md5 box-disk1.vmdk returned the same thing for both files.

I managed to get a vm to boot again by converting the vmdk files to vdi doing the following. (Requires qemu, brew install qemu)

# Convert from `.vmdk` to `.bin`
qemu-img convert box-disk1.vmdk box-disk1.bin

# Convert from `.bin` to `.vdi`
VBoxManage convertdd box-disk1.bin box-disk1.vdi

Updated path to volume for .vdi and machine booted.

In my case, vdi file is slightly larger, don't forget to delete .bin as it's huge. Oh and it fails to authenticate on first run. Anyway, if possible, maybe you should spin up a new vm from scratch instead.

GabLeRoux
  • 163
  • 1
  • 7