The Computer Oracle

How to delete old pagefile.sys and hiberfile.sys on secondary disk (old windows install)

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT


Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping

--

Chapters
00:00 How To Delete Old Pagefile.Sys And Hiberfile.Sys On Secondary Disk (Old Windows Install)
00:40 Accepted Answer Score 15
00:51 Answer 2 Score 3
01:08 Answer 3 Score 1
02:05 Answer 4 Score 3
02:43 Thank you

--

Full question
https://superuser.com/questions/301669/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #filesystems

#avk47



ACCEPTED ANSWER

Score 15


The files are protected using NTFS ACLs. Use takeown to take ownership of them.




ANSWER 2

Score 3


Use unlocker to do this. It can not only remove the locking handles that are giving you an "access is denied" message, but can also delete the files at the same time (in case the program tries to reacquire the handle).




ANSWER 3

Score 3


I had tried all these methods since migrating my OS to an SSD a year ago. Takeown seems to work, but the file cannot be found to delete, it does not show up doing a DIR from the command prompt, in file browsers, ect... Hiberfil is already disabled via command prompt, but I tried to re-enable it and disable it, still no go.

It was like the file was there, but not there.

What worked for me was creating a 'New > Text Document', Renaming that to Hiberfile.sys. I had to do this in a folder because it would not let me create anything except for a folder in my main F: drive. I then Paste it to F:\, then deleting that file. Freed up the 32GB I had tried to get back a few times over the past year.




ANSWER 4

Score 1


You probably need to take ownership. And maybe remove the read-only setting? Re taking ownership: this can be achieved manually, but I prefer to add an (extended, hold shift) context menu.

I used the super useful SysInternals tool to locate my entries, F6 takes me to the registry where I can export the entries. You can copy and paste these into .reg files, save then open them to quickly add :)

Take&ownership-all.REG

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take &ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Extended"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

Take&ownership-Directory.REG

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take &ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"