Cannot remove hiberfile on NTFS partition

56,321

Solution 1

I had same problem. Try:

ntfsfix /dev/sda5

remove_hiberfile option no longer works. ntfs-3g package policy is to use the new tool ntfsfix.

However, this tool didn't work for me either. So I plugged the hard disk in a Windows machine, turned off "Fast Startup" in power button options from within Windows, then shutdown and replaced back the HDD in my Ubuntu machine.

I found about it here: Using Ubuntu To Delete hiberfil.sys From Unbootable Win 8.1

Solution 2

Moving the -o to the end worked for me:

mount -t ntfs-3g /dev/sda5 /mnt/win -o remove_hiberfile 

(Ubuntu 16.04 live cd and a vanilla windows 7)

Solution 3

Read the error again. Just the second line which reads:

Error mounting /dev/sdXY…

Note the /dev/sdXY thing. XY should be replaced with the error you see in your system. Now open terminal and use the following command:

sudo ntfsfix /dev/sdXY

where XY is the troublesome partition shown in the error. For example sda2 or sdb1 or sda5 (as in picture above). ntfsfix is already installed in Ubuntu systems.

Solution 4

I've just had this problem where I removed Windows 8 so couldn't turn off hibernation. I tried to use remove_hiberfile and it didn't work. However because this is just a storage drive, under the "Disks" application, I edited the partition and unchecked bootable. Now I can mount the drive. Hope this helps someone else.

Solution 5

I have run into this problem several times before as well. Recently I had 2 hard drives, one previously running Windows 8 which I got sick of and reformatted and a 2TB storage drive I had been using with Windows 8.

As I had removed Windows 8, had no Windows installation media and had no plans on reinstalling it any time soon, removing the fast and hybrid boot options was not an alternative.

I tried to mount it with the remove_hiberfile option with no luck, still the same error message. Tried mounting as read only then remounting (sudo mount -o remount,rw ) which at first seemed to give me write access, but none of the changes I made were actually written to disk (removed files in nautilus reappeared).

The solution I finally found was to use GParted to move the affected partition to another location on the hard drive, changing the amount of bytes preceding and following the partition. I suspect it rewrites the partition table along with metadata/hibernation flag. I'm glad my guess turned out to work because moving the 1.6TB partition took 19 hours!

There must be a simpler solution though, as I've found other Linux distros I've used don't have the same hesitation to mounting hibernated drives. Maybe the module that checks for the flag can be turned off or replaced? Better yet, giving a damn about the flag should be a couple of choices (mount as read only, mount as read/write, the latter + remove flag etc) and not just an error message.

Anyhow, hope someone else in the same situation will find this information useful.

Share:
56,321

Related videos on Youtube

Shelvacu
Author by

Shelvacu

Updated on September 18, 2022

Comments

  • Shelvacu
    Shelvacu almost 2 years

    I've been looking at questions like Unable to mount Windows (NTFS) filesystem due to hibernation and How do I mount a hibernated NTFS partition? and they all say "Boot into windows" which I am unable to do. Then after much cautioning, the option remove_hiberfile is suggested. I would love that option. I don't care about the programs I had open, or the data in them. The windows partition is on /dev/sda5, so I ran

    sudo mount /dev/sda5 /mnt/win
    

    Lots of reading later...

    sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda5 /mnt/win
    sudo mount -t ntfs-3g -o debug,remove_hiberfile /dev/sda5 /mnt/win
    

    Still no luck. It's like the remove_hiberfile option isn't being recognized, because I don't get an error when trying to use the option remove_hiberfile3ejeiofe but rather the same message.

    This is the message given as a result of all above commands (adding debug did not change anything):

    The disk contains an unclean file system (0, 0).
    Metadata kept in Windows cache, refused to mount.
    Failed to mount '/dev/sda5': Operation not permitted
    The NTFS partition is in an unsafe state. Please resume and shutdown
    Windows fully (no hibernation or fast restarting), or mount the volume
    read-only with the 'ro' mount option.
    

    I am able to mount read-only, but that doesn't help me much.

  • zymhan
    zymhan almost 7 years
    This also works for a Windows 10 partition.
  • miyalys
    miyalys almost 3 years
    ntfsfix worked for me in 2021, whereas -o removehiberfile didn't, resulting in an "Operation not permitted" error.