Jump to content

Diskpart "Access is denied" Error in PE 2.0


mallen

Recommended Posts

OK, I'm struggling to understand where this one is going wrong. I'm using WinPE 2.0, booting it into a ramdisk from a wim, so that the C drive of the system is not locked. I then use diskpart to shrink the C partition down. In about 80% of cases this works perfectly, however I occasionally get the error:

DiskPart has encountered an error: Access is denied.

See the System Event Log for more information.

I have modified my script so that a chkdsk, and defrag are performed before I try and shrink the partition. I have also used the querymax option in diskpart which reports the maximum I can shrink by is 19GB. I am attempting to shrink by 12GB (desired), with a minimum of 11.8GB.

Any ideas anyone?

Thanks

Link to comment
Share on other sites


OK, I've tried a few more things. Booted up from a PE 2.0 disc into RAM (boot the wim from the CD into RAM), then run chkdsk /X. I get a similar error:

Cannot lock current drive. Windows cannot run disk checking on this volume because it is write protected.

I have tried creating files on the disk and it is most certainly not write protected, however, something seems to be holding on to the volume.

Any suggestions anyone?

Link to comment
Share on other sites

This time I tried a smaller shrink amount. Results as follows:

diskpart shrink querymax - returns 19GB

diskpart shrink desired=12000 - fails, "parameter is incorrect"

diskpart shrink desired=9500 - WORKS!

Has anyone else come across the diskpart querymax saying one thing and the shrink operation seeing something different?

Edited by mallen
Link to comment
Share on other sites

zorphnog, Thanks for the suggestion. Indeed I don't think that is the issue. I've now discovered that chkdsk (while windows is running, not PE), shows a problem with $Bitmap, and when I do an offline defrag (in PE), the defragmenter can't move that file. What is interesting is the position that file is located looks to be the same position I can shrink the disk to. Looks like diskpart querymax is seeing the 19GB, but can't shrink beyond this file which is located at the 9500MB from the end of the disk, the point that I can shrink to.

I suspect there is something corrupt with this file. I've tried chkdsk /f in the OS, and rebooting, but then the issue reappears. I've read a few things around defragmenting the MFT to fix this. Does anyone know of an MS / or freeware tool that uses the MS API, tool that will do this?

Thanks

Edited by mallen
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...