21

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.

9
  • try fsck /dev/sda5 command to check disk for errors. Dec 1, 2013 at 3:51
  • That gave fsck: fsck.ntfs: not found
    – Shelvacu
    Dec 1, 2013 at 4:00
  • 1
    sudo ntfsck /dev/sda5 gave Unsupported: replay_log() Volume is dirty. Unsupported: check_volume() Checking 381952 MFT records. Unsupported cases found.
    – Shelvacu
    Dec 1, 2013 at 4:02
  • 1
    @AvinashRaj, I don't know. It shows a loading screen, then it goes black and the backlight flashes.
    – Shelvacu
    Dec 2, 2013 at 4:56
  • 1
    @Mitch I do, and I have booted to it and attempted to get it to fix it. No luck.
    – Shelvacu
    Dec 2, 2013 at 4:58

7 Answers 7

31

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 hd in my Ubuntu machine.

I found about it in here

I hope it works for you! Have a nice day

1
  • ntfsfix worked for me in 2021, whereas -o removehiberfile didn't, resulting in an "Operation not permitted" error.
    – miyalys
    Jul 18, 2021 at 12:08
19

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)

1
  • 1
    This also works for a Windows 10 partition.
    – zymhan
    Sep 22, 2017 at 23:58
4

To delete hiberfil.sys, you have to use the command prompt to manually turn off hibernation.

Boot from the Windows 7 DVD, and press Shift+F10 at the language selection screen, and Boot to the System Recovery Options screen, and select the Command Prompt.

To turn off or disable hibernation, type the following command at the prompt:

powercfg –h off

This will disable hibernation and will remove the hiberfil.sys file from your system.

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.

2

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.

2

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.

0

On a Lenovo 710 desktop with ssd (UEFI) for the operating system and a hard drive for other stuff, I installed ubuntu (not as duel boot) and could not access my hard drive due to the error described above. However, rebooting while hitting F2 brought me to a recover option for windows. I declined the recovery, and on the next screen responded that I wanted to "exit windows". Rebooting to ubuntu then allowed accessing the hard drive.

Maybe, if you had a recovery partition, even though you selected to over-write windows, something along these simple lines would work for you.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .