I have a vmware-server installation running a virtual machine, however I have subsequently (and accidentally) deleted the .vmx configuration file.
It appears that VMWare still has the file open, so it won't (as I understand it) be lost until VMWare is closed (eg I reboot the machine).
Is there anything I can do to recover the file whilst in this state?
(O/S is Ubuntu 7.04 if that helps.)
On Wed, Dec 05, 2007 at 11:04:56AM +0000, Mark Rogers wrote:
I have a vmware-server installation running a virtual machine, however I have subsequently (and accidentally) deleted the .vmx configuration file.
It appears that VMWare still has the file open, so it won't (as I understand it) be lost until VMWare is closed (eg I reboot the machine).
Is there anything I can do to recover the file whilst in this state?
(O/S is Ubuntu 7.04 if that helps.)
If you edit the virtual machine settings (via the Vmware console menus) I would think that it will rewrite the .vmx file. There's certainly no harm trying, you can change a fairly innocuous setting.
Chris G wrote:
If you edit the virtual machine settings (via the Vmware console menus) I would think that it will rewrite the .vmx file. There's certainly no harm trying, you can change a fairly innocuous setting
What brought this to light was the fact that we couldn't open it in the console because the .vmx was missing!
(As you may or may not be aware, you can close the console after starting a VM and it will continue running.)
If there was something I could do within the VM which would cause a write to the .vmx that might work, though. Any suggestions?
The VM is running SME (www.contribs.org) which is a modified CentOS 4. I have access to it via SSH only.
At Wed, 05 Dec 2007 11:25:11 +0000, Mark Rogers wrote:
Chris G wrote:
If you edit the virtual machine settings (via the Vmware console menus) I would think that it will rewrite the .vmx file. There's certainly no harm trying, you can change a fairly innocuous setting
If there was something I could do within the VM which would cause a write to the .vmx that might work, though. Any suggestions?
The VM is running SME (www.contribs.org) which is a modified CentOS 4. I have access to it via SSH only.
Is VMWare just a user-space program? If so, does it respond to any of the signals you'll find in your $ kill -l
Obviously, don't send KILL or TERM to it.
I don't really know anything about this, I just wanted a break from despairing at how thick undergraduates can be. Uh oh, did I think that or type it? Is this thing being archived?
Richard
I may have found the "solution", and why it won't work in my case....
See http://www.linux.com/articles/58142 for details, but: sudo lsof | grep deleted .. gives a list of files open by processes that have been deleted, or alternatively sudo lsof | grep vmx .. gives a list of open .vmx files
Given that info I could (in theory) work out the file descriptor information and recover the file from /proc (I won't duplicate the above article here).
However (and it's a big "however"), it turns out that VMWare does not keep the .vmx files open after all, so I appear to have lost it.
This would have worked had I deleted the vmdk (disk image) files so that's something, I guess. Rebuilding a .vmx file from scratch is a nuisance more than anything else.
On Wed, Dec 05, 2007 at 11:42:05AM +0000, Mark Rogers wrote:
I may have found the "solution", and why it won't work in my case....
See http://www.linux.com/articles/58142 for details, but: sudo lsof | grep deleted .. gives a list of files open by processes that have been deleted, or alternatively sudo lsof | grep vmx .. gives a list of open .vmx files
Given that info I could (in theory) work out the file descriptor information and recover the file from /proc (I won't duplicate the above article here).
However (and it's a big "however"), it turns out that VMWare does not keep the .vmx files open after all, so I appear to have lost it.
This would have worked had I deleted the vmdk (disk image) files so that's something, I guess. Rebuilding a .vmx file from scratch is a nuisance more than anything else.
I was just going to say that - the .vmx files are just text files in the style of Windows .ini files. If you create a new virtual machine you could copy the .vmx file created, make any obvious changes required (i.e. point it at the disk image for the one that's lost its .vmx) and then tune as required.
Or you could even just create a new virtual machine and tell it to use the existing disk image file(s).
Chris G wrote:
Or you could even just create a new virtual machine and tell it to use the existing disk image file(s).
That's the route I went in the end.
Something to be aware of when doing this: MAC addresses will change, and that can break some distros (eg Ubuntu) which will end up with eth0 (no longer there but configured) and eth1 (there but not configured). It's pretty easy to fix once you've worked out what's going on.
The challenge was more because I knew I should be able to recover a deleted-but-still-open file but didn't know how, and couldn't think of a good way to search for it on Google. As it happens I actually found out by searching against the subject I used for this thread with "Linux" added to it. Doh!
Useful to know how to do it for future use, though.