VMware Cloud Community
sambino
Contributor
Contributor

Restore VMDK File

I was moving a vmdk file to another Lun on the SAN via virtual centre and it crashed part way through the file is still on the original lun but isnt showing as a drive anymore when I try to start the VM I get the file specified is not a virtual disk

How can I get it back in the Lun browser it shows like a flat file not a disk

0 Kudos
9 Replies
wila
Immortal
Immortal

Hi,

Please login directly to your ESX host (or ssh to it) and get the directory listing of the VM using:

ls -al

and post the output back here.

While you are doing that...do the same thing for the target directory of where you wanted to migrate your VM to.



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
sambino
Contributor
Contributor

Original location

drwxr-xr-x 1 root root 3080 Dec 13 15:48 .

drwxrwxrwt 1 root root 1540 Jul 23 2007 ..

-rw-rr 1 root root 37 Dec 3 04:48 Barrowdata1-f5b5adfe.hlog

-rw------- 1 root root 161061273600 Dec 13 14:50 barrowdata1flat.vmdk

-rw------- 1 root root 10737418240 Dec 13 14:50 Barrowdata1-flat.vmdk

-rw------- 1 root root 8684 Dec 13 14:50 Barrowdata1.nvram

-rw------- 1 root root 343 Dec 7 17:12 Barrowdata1.vmdk

-rw------- 1 root root 714 Feb 8 2008 Barrowdata1.vmsd

-rwxr-xr-x 1 root root 3156 Dec 13 15:41 Barrowdata1.vmx

-rw------- 1 root root 278 Dec 13 15:23 Barrowdata1.vmxf

-rw------- 1 root root 107374182400 Dec 13 14:50 barrowmain1_1-flat.vmdk

-rw------- 1 root root 347 Dec 7 17:12 barrowmain1_1.vmdk

-rw------- 1 root root 53687091200 Dec 13 14:50 barrowmain1-flat.vmdk

-rw------- 1 root root 344 Dec 7 17:12 barrowmain1.vmdk

-rw-rr 1 root root 46518 Dec 3 04:48 vmware-31.log

-rw-rr 1 root root 60680 Dec 13 14:50 vmware-32.log

-rw-rr 1 root root 21602 Dec 13 15:23 vmware-33.log

-rw-rr 1 root root 21602 Dec 13 15:23 vmware-34.log

-rw-rr 1 root root 22135 Dec 13 15:28 vmware-35.log

-rw-rr 1 root root 22135 Dec 13 15:31 vmware-36.log

-rw-rr 1 root root 22135 Dec 13 15:41 vmware.log

-rw-rr 1 root root 279 May 25 2008 .vzmutex

The destination is empty barrowdata1flat.vmdk is the file I need back

0 Kudos
wila
Immortal
Immortal

Hi,

>The destination is empty barrowdata1flat.vmdk is the file I need back

At the destination is the file really 0 bytes or a few bytes (this makes a big difference)?

Did you name the file barrowdata1flat.vmdk yourself, as in that you on purpose put "flat"in the name? The reason I'm asking this is that I'm trying to understand what has happened. A virtual disk on ESX usually contains of 2 files, one called -flat.vmdk, where name is for example barrowmain1_1 on one of your disks.

The file without the "-flat" bit in the name is the meta data plain text file and contains details about your disk like number of cylinders and heads etcetera. (If you haven't changed your disk layout and have a backup, you could put that file back from the backup...)

The file with the "-flat"suffix normally has the data in it ..

What size was your disk?

The bit that has me puzzled from your directory listing is this file:

-rw------- 1 root root 161061273600 Dec 13 14:50 barrowdata1flat.vmdk

Note that it doesn't have a dash in the name, but it does appear to contain data?? Also note that the first letter is lowercase while files are case sensitive.. this isn't making much sense now to me. Was this file copied in from another VMware product?

Can you show us the content of the Barrowdata1.vmdk file? and your vmx file?



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
sambino
Contributor
Contributor

Hi

What happened was I had a vm with 4 virtual disks these were(I inherited the system so didnt set up the files names which are very confusing!!)

1) Barrowdata1.vmdk which is 10 GB

2) barrowmain1.vmdk which is 50 GB

3) barrowmain1_1.vmdkwhich is 100 GB

4) barrowdata1flat.vmdk 150GB

no 4 the name may now be wrong, what happened was I wanted to move it to to another LUN with more space so I could expand it, I started the copy and VCENTRE went funny and stopping doing the copy at 10%, I cancelled the copy and expected the file to go back to the original LUN which it shows that it has but when I started the vm it could not find the file for the 150GB drive and would not boot when I checked the file name it had added the flat bit or so I though so I renamed it back to what I though it should be and tried to re add it as a disk but it did not reckonise the drive. I guess it is probably now named wrong from what you say. I want to be able to re add it but it dosent show as a valid drive to add. barrowdata1flat.vmdk should be barrowdata1-flat.vmdk but there is no matching barrowdata1.vmdk file can this be recreated ?

0 Kudos
sambino
Contributor
Contributor

VMX file attached

0 Kudos
wila
Immortal
Immortal

Hi,

Thanks, that helps a lot.

>I want to be able to re add it but it dosent show as a valid drive to add. barrowdata1flat.vmdk should be barrowdata1-flat.vmdk but there is no matching barrowdata1.vmdk file can this be recreated ?

Yes I think that the descriptor file can be recreated. The data itself is in the -flat file.. and you still have a large data file there.. it's just named wrongly and the descriptor file is missing.

Have a look at this page:

http://sanbarrow.com/vmdk/vmdk-when-its-too-late.html

and in particular the bit about the "missing descriptor file".

Now the first thing to do is to make sure you have a copy of the barrowdata1flat.vmdk file BEFORE you try anything else.

Also make a copy of your vmware.log files and upload a copy here of a part with a working boot cycle.



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
wila
Immortal
Immortal

Also make a copy of your vmware.log files and upload a copy here of a part with a working boot cycle.

In your directory listing from above that appears to be either one of these two files:

-rw-r--r-- 1 root root 46518 Dec 3 04:48 vmware-31.log
-rw-r--r-- 1 root root 60680 Dec 13 14:50 vmware-32.log



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
sambino
Contributor
Contributor

Hi Wila

Thanks for all your help, with the pointers you gave me and a further search about descriptor files on the forums, I managed to recreate the file. because of the screwedup naming convention of the VM I renamed the flat file as you suggesed then created a new vm with the name of the file, and copied the descriptor file back to where the original VM was and could reattach the drive and its all great again.

I guess the safest way to move the drive to another LUN its to do it all in the shell ?

Am I right in thinking I should

1) Power down Vm and remove drive but retain files

2) Copy the 2 VMDK FIles flat and descriptor to the new LUN

3) Attached the new copy to the VM

4) Restart the VM

Again thanks for your help you are a life saver

0 Kudos
wila
Immortal
Immortal

Hi,

Again thanks for your help you are a life saver

I guess the safest way to move the drive to another LUN its to do it all in the shell ?

Am I right in thinking I should

1) Power down Vm and remove drive but retain files

2) Copy the 2 VMDK FIles flat and descriptor to the new LUN

3) Attached the new copy to the VM

4) Restart the VM

Well you have to make sure upfront that you have enough room on the target LUN.

If you are on ESX3.5 (not the embedded version) and don't have VirtualCenter, then you can use either VMware converter or you could search on my forum name and a script called vm-relocate.sh The script will automate the steps for you and adjust the vmx file accordingly (if needed) See

That's what I use to move my VMs around on attached storage.

Again thanks for your help you are a life saver

Well well.. it's just data ... not lives Smiley Happy But I sympathize with it and am glad to hear you got your data back!



--

Wil

_____________________________________________________

Visit the new VMware developers wiki at http://www.vi-toolkit.com

edit: added direct link to the script I referenced.

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos