Windows 10 temp file clean up - Error(5) shrinkPartition - Capture fail
-
I have a windows 10 machine that has 25GB of windows.old temp files. I’m unable to capture an image after I free up the temp files using the built in windows 10 storage clean tool.
This is not a picture from the system I’m imaging but wanted to show where I’m doing the cleanup.
This is the error message I get when I try and capture the image.
-
@duanekaeb After the cleanup also run defrag tool in Windows. This might sound strange but I am fairly sure this has helped others before. You may also search Ehe forums on that error message to get more information.
-
@Sebastian-Roth is it safe to run defrag when using an SSD?
-
@duanekaeb On Windows 10 when you run “defrag” on an SSD it will run “trim” on it instead, so yes, it is.
You may want to schedule a chkdsk as well.
-
This is how I clean a Windows OS prior to capture.
@echo off REM Cleanup_Mastering1.cmd is manually executed during the Windows mastering as Administrator in Audit Mode REM Disk Cleanup with all options selected cleanmgr /verylowdisk del /Q /F "C:\Windows\Temp\*.*" del /Q /F /S "%LOCALAPPDATA%\temp\*.*" del /Q /F /s "%APPDATA%\Microsoft\Windows\Recent\AutomaticDestinations\*.*" REM Delete Shadow Copies (Restore Points) vssadmin delete shadows /all /quiet REM Force chkdsk at next startup echo y | chkdsk c: /offlinescanandfix REM yes a second time del /Q /F "C:\Windows\Temp\*.*" REM Clear All Event Logs for /f %%a in ('WEVTUTIL EL') do WEVTUTIL CL "%%a" REM Restart! shutdown -r -t 0
Notice the restart.
‘cleanmgr’ will pop up with a prompt… ‘OK’ it.
If you’ve allowed your system to retrieve and apply Windows Updates (don’t!) the ‘cleanmgr’ command will take a very long time; about an hour. You’re then better off manually deleting “C:\Windows\SoftwareDistribution” before this.
-
@Quazz & @Sebastian-Roth, I ran a chkdsk and did a defrag/trim and I’m still getting a resize test.
-
@sudburr Thanks for the script. I executed it but I’m still getting the same shrinkPartitiion error.
-
@duanekaeb Please boot up Windows on that machine and open disk management tool, take a picture of that and post here.
-
-
@Sebastian-Roth any recommendations?
-
@duanekaeb One other thing I had to do once upon a time was run
dism /online /cleanup-image /startcomponentcleanup
in command prompt before sysprep and capture
-
@duanekaeb The partition
sda4
that we see in the terminal output windows doesn’t show up in windows disk management tool. Most probably because it’s a hidden partition. Still doesn’t make too much sense but to me it looks like it.Please schedule a debug capture task (as you normally would in the web UI but just before you click create task there is a checkbox for debug mode), boot up the host and when you get to the shell run the command
parted -l
, take a picture and post that here. -
@Quazz I ran all four of these commands I found on another post but still no go.
kafluke Apr 24, 2019, 10:06 AM
@Quazz I saw a post by you in another thread and took your advice. I ran all these commands and it’s capturing now:dism /online /cleanup-image /startcomponentcleanup
dism /online /cleanup-image /restorehealth
sfc /scannow
chkdsk /f
-
@Sebastian-Roth, here you go.
That may not be what you’re looking for. I pressed enter and the command line popped up. Parted -1 returned an error but I was able to get something when I typed in parted. This is a screen shot of the print command.
-
@duanekaeb Thanks for the pictures. What I posted was the command
parted -l
- the parameter being a lower case l (like lion). But using the print command you still got us exactly the information I was hoping to see.Ok, so the partition layout is fine from my point of view. So now I am wondering if
C:
is simply almost full and that is causing the problem. Reviewing the pictures again I saw something that I have not noticed before:Needed relocations: ... (16179 MB)
While I am not an expert on the ntfs3g-lib implementation I am really wondering if this is just “too much for it”. It tries to shrink the partition and for that to be able to do it would need to relocate/move roughly 16 GB of data. While it’s not nice that it fails to do so I can kind of understand it’s having a hard time to do so.
I really wonder why defrag didn’t help you with this. Probably a bit different on the SSD, hmmmm. Not sure what else we can do for you.