VMware Communities > VMTN > VMware Server > VMware Server 1 > Discussions

This Question is Answered

13 Replies Last post: Mar 19, 2008 3:12 PM by jakganesh
Reply

Can virtual machine keep running after accidentally deletion of virtual disk?

Mar 16, 2008 9:54 AM

Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008

Some days ago I reboot my vmware Ubuntu Linux host machine and a few minutes after, tryng to restart a virtual machine, it has disappeared!!

Investigating in the case, I've excluded many events such as system crashes, vmserver chrashes, etc..., and only one possibility remains: it is possibile that I've accidentally delete by handthe .vmdk files from hard disk. But as all log files state, if I did such deletion it is happened at least 2 days before the reboot and until the reboot I WAS able to use virtual machine.

Here is the apparently stupid question: can a virtual machine keep running if virtual disk files have been deleted by hand?

No other machine in my inventory is afflicted by this problem.

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 16, 2008 10:01 AM
Click to view AWo's profile Virtuoso AWo 2,938 posts since
Nov 27, 2003
It runs as long and as good as a hardware system where you deleted the partitions. I would say, as long as no data is been requested from disk or must be written to.

AWo
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 16, 2008 11:56 AM
in response to: AWo
Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008

Here is the matter! And it is the reason for such a strange question.

The VM was running a CRM used form different users by a web interface. Every operation trough the web interface needs a SQL query and/or a cache file access. All users, included myself, have written data in the CRM, so at least some SQL query were made. That's why it seems (to me) quite impossible to keep running for 2 full work days without disks.

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 2:38 AM
in response to: midimarcus
Click to view AWo's profile Virtuoso AWo 2,938 posts since
Nov 27, 2003
I agree. If there are many requests, the disk must have been available.

AWo
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 3:23 AM
in response to: AWo
Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008

This confirmation makes the case even more strange!

Anyone has had such a similar experience?

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 4:45 AM
in response to: midimarcus
Click to view saxa's profile Master saxa 1,336 posts since
Jun 2, 2006
Anyone has had such a similar experience?

I explicitly tested this. On CentOS 4.3 host I completely deleted the VM's directory, including vmx and vmdk files, by using WinSCP from my Windows workstation.

The "deleted" VM (W2K Server) worked further! I could reboot it from inside of it, I could copy and move files from and to the network...
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 4:55 AM
in response to: saxa
Click to view AWo's profile Virtuoso AWo 2,938 posts since
Nov 27, 2003
Damn! Did VMware reach a new level auf fault tolerance here? I tried to run ESX within VMware Workstation to eliminate the hardware underneath completely, but that didn't work, yet. ;-)

AWo
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 5:25 AM
in response to: saxa
Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008

Ok, sad experience but useful for times to come.

Now I know that I can do backup of data or application settings running inside a virtual machine if I accidentally delete virtual machine's config file and disks, at lease until I don't reboot host machine.

It would be interesting to know how vmware server realizes it. Perhaps is there some physical disk management layer lower than OS one?

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 5:35 AM
Click to view Daniel.D.'s profile Expert Daniel.D. 249 posts since
Feb 1, 2008
The answer to this apparent mistery is very simple. Your host system is linux, so your filesystem should be Ext3 or similar.
Ext3 and similar filesystems are based on inodes. When you issue a delete command for a file, it is carried away immediately, so the file dissapears from your sight.
But if the file was still in use by another process (vmware server in your case), the filesystem will not actually delete it until that process frees their locks over the inodes pointing to the file.
So you may have issued an accidental delete command over the vmdk files some days before and the virtual machine would still be operational until the reboot of the host. That's absolutely normal under Ext3 and similar filesystems.
That's why you can install new software in linux without having to reboot or without having to stop a previous version of the same software.
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 5:52 AM
in response to: Daniel.D.
Click to view Peter_vm's profile Guru Peter_vm 9,057 posts since
Feb 1, 2006
Moderator
It is so logical.
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 6:03 AM
in response to: Daniel.D.
Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008

This is a helpful confirmation.

But, as I've investigate on an image of hard disk trying to undelete files, I've constated that all inodes reletad to deleted vm files have been reallocated. As far I know inodes have been reallocated before host reboot, otherwise I'd be able to restore deleted files. Does locks over inodes be freed on reallocation?

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 17, 2008 8:56 AM
in response to: midimarcus
Click to view Daniel.D.'s profile Expert Daniel.D. 249 posts since
Feb 1, 2008
As far as I know, as long as the affected files are still in use by another process, their inodes cannot be reallocated, because they must still point to the files and hold the number of locks still present. As soon as the process finishes and frees its locks, the inodes become reallocatable. Your deleted files would have been overwritten most probably during or after the boot process; I don't think they could have been overwritten before... unless there was enough activity demanding writings in the short time between the virtual machine stop and the host system shutdown, of course.
Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 19, 2008 7:46 AM
in response to: Daniel.D.
Click to view midimarcus's profile Novice midimarcus 6 posts since
Mar 15, 2008
I made some more tests. I succeeded to replicate the problem with the following steps:
  1. Install same guest OS (Ubuntu 7.10 server) in the same host OS (Ubuntu 7.10 desktop)
  2. Work a bit with the guest os installing software an/or other typical operations
  3. While guest is RUNNING I make an rm -rf <guest_folder>
  4. Guest KEEPS RUNNING with NO ERRORS or warnings, both reading and writing data from and to guest virtual disk
  5. Shutdown guest and a warning is displayed by server console about unability to read virtual machine configuration files and virtual machine can't restart
I underline that host physical ram is 2GB and swap was almost empty after vm files deletion.
So that's the truth, you can keep running a virtual machine even if you delete its config and virtual disks files.

Now, just hoping to add some useful information, I am able to restore deleted file from disk until host OS is rebooted. After Ubuntu host OS reboot, inode related to deleted files are ALWAYS reallocated. As far as the test has been made with a 120 GB hard disk with more than 84GB free, it seems quite improbable that those inodes are casually reallocated by Ubuntu. Other deleted files on disk are not always and systematically reallocated after a reboot. It would be interesting to know why this selective reallocation is performed.

Thanks to all for your help in this discussion.

Reply Re: Can virtual machine keep running after accidentally deletion of virtual disk? Mar 19, 2008 3:12 PM
in response to: midimarcus
Click to view jakganesh's profile Hot Shot jakganesh 175 posts since
Oct 23, 2007
If you take a harddisk it will have memory locations, see for example when u format a disk it will create a partition, while formating it will write the File allocation table,
when ever you delete in real senario only the entry in the File allocation table will get deleted not the whole file ok, already your VM is running from that particular VMDk location so still it has memory address with it for that particular location in your RAM, so when you reboot your VM the process has to start freshly from the starting location, so again it should go to File allocation table where that VM files should be so after rebooting it will not find that in the file allocation table because already it got deleted.





Jakkireddy
Actions