This guide for fixing "The drive where Windows is installed is locked" error works for Windows 10, Windows 8.1/8.
Brief description what caused the error (if not interested skip to Repair steps)
Explaining for novice users - further below VHD is mentioned.
VHD is Virtual Hard Disk and can be regarded as real disk as it has the same logical structure, e.g. partitions, boot sectors e.t.c. and more important - you can install an operating system like Windows on it!
The whole concept of virtualization (virtual processors, virtual disks, virtual machines) is not only interesting but also very practical as home computers are usually powerful enough to run an operating system on top of another.
Installed new version of Ubuntu 12.04 with Virtual Box in dual boot with Windows 7. My Windows 7 system had already a Windows 8 VHD booting natively.
Wanted to try if a Windows 8 installation to VHD could be run by Virtual Box on Ubuntu.
Created a new virtual machine with the VHD in question in Virtual Box and started it.
No luck. My physical processor did not have virtualization capabilities.
So rebooted my computer and selected Windows 8 VHD on boot just to check if the VHD is still intact.
Was greeted with the error message:
The drive where Windows is installed is locked. Unlock the drive and try again.
Refresh or Reset your PC does not work in this situation as Windows automatic repair somehow cannot resolve the problem of locked drive. In reality not the whole drive is locked, usually one or more system files are locked and we are going to resolve the problem step by step.
Booted my Windows 8 Install USB and started Recovery console.
First thing I tried was to check if Windows drive has still a correct disk structure using the command chkdsk.
chkdsk v: /R ( demagged Windows was mounted to drive v: )
Note: The /R option "Locates bad sectors and recovers readable information (implies /F)." The process is pretty long on larger disks. You can use the /F option instead on large disks if you do not want to wait for a more thorough checking.
So the alternative for large disk to the command above is:
chkdsk v: /F
No errors - everything was fine.
The error was showing pretty early before appearance of the "running circle" when booting Windows 8 so the problem was in some of the boot environment files, winload.exe or the very first system files loaded by winload.exe. (Winload.exe is Windows loader for Vista and later Windows versions and is the first file loaded and executed by Windows boot manager after you select to load Vista or Windows 7/8/10 OS from boot-menu.)
After spending some time on several forums it appeared that the error message in question was reported in connection with error code 0xC0000098.
The message for error code 0xC0000098 is
"The volume for a file has been externally altered such that the opened file is no longer valid."
Attaching my Windows 8 VHD to Virtual Box and starting it had as result that some file needed for starting up the system was altered by Virtual Box and left in an inconsistent state.
For repairing boot environment files Microsoft delivers the utility bcdboot.
bcdboot is known to fix BCD errors but it also recreates the whole \boot folder, fixes bootmgr and some other boot related files new in Windows 8/10.
bcdboot v:\Windows /s v:
(demagged Windows was mapped to drive v: and v: was also the active partition!)
When using this command and having several Windows Vista/7/8/10 installations in dual or multi boot you should always choose the latest Windows version as parameter to the command because from this source (v:\Windows) the system protected boot related files are taken and installed to the system partition (active partition) if no /s parameter is specified.
The /s parameter specifies the target partition/drive and has to be the active partition on a MBR disk or the EFI System partition on a GPT disk.
That was it.
Rebooted and SUCCESS !
There was a small drawback however after using bcdboot - the "Repair your computer" in advanced boot options on F8 key for the repaired loader (and boot menu entry) was missing but that was easy to solve with just two commands on command prompt (from a running Windows 8 VHD system in my case):
ReAgentC /disable ReAgentC /enable
And everything was as it was before going into trouble...
Use in case you still cannot boot!
It should be mentioned that if a system file needed for starting up the system is tampered the command:
should fix the issue - at least Windows should be able to start in safe mode where you could do more comfortable further investigations what is causing the problem if it still persists.
You can try offline repair of system files booted from USB/DVD:
sfc /scannow /offbootdir=c:\ /offwindir=d:\windows
- "offbootdir" is the system reserved partition (usually about 100 MB in size) or the active partition on MBR disks
(on UEFI firmware and GPT style disks this is the EFI System partition used for booting)
- "offwindir" is the Windows directory on the drive you would like to fix.
- change drive letters in command above to reflect your mappings when booted from DVD/USB!
You can use diskpart utility (part of Windows and Windows recovery/WinPE) to map drives, e.g. assign drive letters to unmapped partitions
If there are still problems booting up your system, next would be to check:
- integrity of drivers
- anti-virus program (switching it off)
and so on the chain of loaded programs.
A start-up with boot logging would also be helpful as it would record the last loaded file at error point. This information could be useful when looking for further help on your favorite computer forum.
Hope this helps.
Even small donations appreciated for site maintenance and further development. Thank you.