Message “Unable to Obtain a Lock on Drive [n]:” when Creating or Restoring an Image
The message "Unable to obtain a lock on drive [n]:" appears if Image for Windows cannot gain exclusive access to a partition while trying to create or restore an image. If this message occurs while attempting to create an image, then "n" will represent the source drive letter. If the message occurs while attempting to restore an image, then "n" will represent the target drive letter.
Please note the following scenarios which can prevent a partition from being locked by Image for Windows:
- The partition which holds the Windows installation will not be lockable if you are currently booted into that Windows installation.
- Any partition which holds an in-use paging file (PAGEFILE.SYS) will not be lockable.
- Applications can have open files which prevent the partition from being locked.
- Some anti-virus applications will prevent the locking of any partition, even with their real-time protection feature disabled.
If files in use by certain applications are preventing a lock from being obtained, you may be able to simply close those applications to obtain a lock. You may find the free Sysinternals utilities Process Explorer (GUI) or Handle (command line) handy for determining which applications have open files on the drive letters you are trying to image.
If simply closing applications does not work, there is a way, built into Windows 2000/XP/2003/Vista and Windows 7/8.x/10, to force all open files closed. Please note that, in some cases, this method can result in corrupt files and should be used with caution. To attempt to force all files closed on a given partition, issue the following from a command line:
chkdsk [n]: /x
Where "n" represents the drive letter in need of locking. For example, if the drive letter is F:, the command would be:
chkdsk f: /x
Please note that this command will not help in all cases (for example, it will not allow you to overcome an in-use PAGEFILE.SYS.)
Unable to Obtain a Lock while Attempting to Create an Image
If you cannot obtain a lock on a partition while attempting to create an image, then you can choose to:
- Use PHYLock, which optionally installs with Image for Windows, to help ensure reliable imaging, even with an unlocked partition. (PHYLock is not compatible with Windows 9x/Me and not used in WinPE builds.)
- If you have already installed PHYLock and rebooted, and still have problems obtaining a lock, please refer to the following article: Unable to Obtain a Lock when Using PHYLock.
- If you have already installed PHYLock and rebooted, and still have problems obtaining a lock, please refer to the following article: Unable to Obtain a Lock when Using PHYLock.
- Use Microsoft's Volume Shadow Copy service (VSS). To do this, enable the Use VSS When Available option in Image for Windows (this doesn't require a reboot). You must be running Windows 2003 or later.
- Retry the lock. For example, if you had a program using the drive and have now closed it, select Retry to make another lock attempt. Enabling the Attempt Aggressive Lock on Retry option will invalidate all open handles to the volume and try to force dismount it before locking (this may result in lost data).
- Ignore the lock failure message. This will attempt to force all open handles off the partition and continue with the backup without locking the partition. (Only recommended if you know that the partition is not truly in use.)
- Create the image using Image for DOS or Image for Linux instead of Image for Windows. (Your purchase of Image for Windows includes Image for DOS and Image for Linux at no extra charge.)
- Run Image for Windows from TBWinPE or TBWinRE.
- Run Image for Windows from an alternate Windows installation. (Please note that you will be able to create an image of an NTFS partition, even from Windows 9x/Me.)
Unable to Obtain a Lock while Attempting to Restore an Image
If you cannot obtain a lock on a partition while attempting to restore an image, then you can choose to:
- Restore the image using Image for DOS or Image for Linux instead of Image for Windows. (Your purchase of Image for Windows includes Image for DOS and Image for Linux at no extra charge.)
- Run Image for Windows from TBWinPE or TBWinRE.
- Run Image for Windows from an alternate Windows installation. (Please note that you will be able to restore an image of an NTFS partition, even from Windows 9x/Me.)
- Ignore the lock failure message. This will attempt to invalidate all open handles and force a dismount. (Only recommended if you know that the partition is not truly in use.)
Please note that PHYLock cannot be used to enable the restoration of a partition that cannot be locked. PHYLock can only be used to help image a partition that cannot be locked by other means.