A while ago I swapped my main hard disk for a SSD. Now the old one is used as a secondary hard disk, and my OS is a fresh windows install on the main SSD disk.

Nevertheless, there are still huge pagefile.sys and hiberfile.sys on that secondary hard drive. Those are not the ones used by the current windows, as those do exist on C:.

I tried to attrib -s -h them, but it refused with "Access denied".

Any idea how to delete those old unused system files and reclaim the space?

link|improve this question
1  
if all else fails, you can delete them from a linux live disk - say, using unetbootin if you don't want to waste a disk on it – Journeyman Geek Jun 24 '11 at 13:49
If you don't need any of the data then formatting the disk should recover the space, but I'm assuming in this case you do. – ChrisF Jun 24 '11 at 14:02
- I do need the data indeed :) – Silvermist Jun 24 '11 at 16:15
1  
- Linux is an option but I'd rather keep that for last, as it sounds like it would take a while to do, and I have 0 experience with unix commands – Silvermist Jun 24 '11 at 16:16
Most Linux live-cds boot into a desktop environment, so you just open the file manager and delete your files. Not all, however, automatically mount NTFS partitions. Two that I know of that do mount them are Ubuntu and Centos. – Joe Internet Jun 24 '11 at 17:38
feedback

3 Answers

up vote 3 down vote accepted

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

link|improve this answer
Takeown worked but I still could not delete. Ran commmand prompt as administrator : F:\>takeown /f hiberfil.sys SUCCESS: The file (or folder): "F:\hiberfil.sys" now owned by user "Me". F:\>attrib hiberfil.sys -s -h Access denied - F:\hiberfil.sys F:\>del hiberfil.sys Could Not Find F:\hiberfil.sys – Silvermist Jun 24 '11 at 16:13
Then also try icacls hiberfil.sys /grant everyone:f - taking ownership doesn't automatically adjust the ACLs. – grawity Jun 24 '11 at 16:32
Icacl worked fine! Thanks a lot. – Silvermist Jun 25 '11 at 5:22
feedback

To delete hiberfil.sys on the active drive use one of these methods

In Windows 8

  • Control Panel > Hardware and Sound > Power Options
  • Click Change settings that are currently unavailable if it appears
  • Uncheck Enable Hybrid Boot and Show Hibernate options

In Windows 7 and Windows Vista

  • Open an administrator command prompt and issue the command powercfg -h off

In Windows XP

  • Control Panel > Power Options > Hibernate tab
  • uncheck Enable Hibernation and click on Apply followed by Ok
  • Reboot and delete the hiberfil.sys file
link|improve this answer
feedback

Use unlocker

http://www.filehippo.com/download_unlocker/

link|improve this answer
In addition to clicking "Unlock All" you can select delete in the Action dropdown. – Kevin Jun 24 '11 at 16:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.