A running virtual machine tries to create lock files to prevent consistency problems on disks. If the virtual machine did not use locks, multiple virtual machines might read and write to the disk, causing users to lose data.
Lock files are always created in the same directory as the .vmdk or .pln file. There are two types of lock files: reader and writer. A nonpersistent disk is protected by reader lock files, while persistent and undoable disks use writer lock files. A disk protected by a writer lock file can be accessed by only one virtual machine. A disk that has reader lock files can be read by more than one virtual machine but cannot be written to. The extents of a plain disk are individually locked, using the same method.
A virtual machine will remove lock files it created when the virtual machine is powered off. If it cannot remove the lock, a stale lock file will be left protecting the .vmdk or .pln file. For example, if the machine crashes before the virtual machine has a chance to remove its lock file, there will be a stale lock.
If a stale lock file remains when the virtual machine is started again, the virtual machine will try to remove the stale lock. To make sure that no virtual machine could be using the lock file, the virtual machine checks the lock file to see if:
If those two conditions are true, the virtual machine can safely remove the stale lock. If either of those conditions are not true, a dialog box will be shown explaining what the user can do about the lock.
Raw disk partitions are also protected by locks. However, if the host operating system is installed on the same raw disk that the virtual machine is using, the locks are ignored. VMware strongly recommends that the raw disk for the virtual machine not be installed on the same raw disk as the host operating system for this reason.
© 2001 VMware, Inc. All rights reserved.