I have 2 OS installed on my PC (Windows 8 and Linux). Yesterday I lost my GRUB menu and while trying to restore it from live USB I accidentally formatted my uefi boot partition (that is /dev/sda5) and now I'm trying to restore grub but update-grub outputs:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-51-generic
Found initrd image: /boot/initrd.img-3.2.0-51-generic
Found memtest86+ image: /boot/memtest86+.bin
  No volume groups found
Adding boot menu entry for EFI firmware configuration

So there is no Windows.. I guess the problem is here: when trying to access partition where Windows is installed I'm getting

Windows is hibernated, refused to mount.
The NTFS partition is in an unsafe state. Please resume and shutdown
    Windows fully ...

And it's true, I hibernated Windows before booting from live USB. But I'm unable to boot into windows (as I formatted uefi partition) to completely reboot it.

Also I tried to mount /dev/sda2 (Win partition) with ro option, no help. What can I do?

UPD Nor sudo ntfsfix /dev/sdaX niether remove_hiberfile helps


You have two issues here, and you're mixing them up....

Issue 1: Trashed ESP

Based on your description, and in particular the claim that you "accidentally formatted [your] uefi boot partition," it sounds like your EFI System Partition (ESP) is destroyed. This is a serious problem because the ESP holds boot loaders for both Windows and Linux. Thus, when you trashed your ESP, you rendered both OSes unbootable, and you cannot restore one OS's bootability from the other OS -- at least, not without a backup of the files that had been on the ESP. Thus, you may need to use Windows recovery tools to restore the Windows boot loader. I'm not very familiar with these tools, so I can't provide much help on this score. Also, update-grub by itself will not help, since that tool simply updates GRUB's configuration file, which may not have been damaged, depending on the details of the GRUB configuration. Instead, you'd need to use grub-install to re-install GRUB to the ESP.

One caveat to the preceding comments is that it is legal to have multiple ESPs on a disk. You claim that your ESP is /dev/sda5, which is an unusual partition number for an ESP. (The ESP is usually the first or second partition on the disk.) Thus, it's conceivable that the Windows boot loader remains intact, presumably on /dev/sda1 or /dev/sda2, and that you've simply trashed GRUB on /dev/sda5. My suspicion, though, is that you have just one ESP in an unusual location (perhaps this is the result of manual installation of both Linux and Windows, or reconfiguration of your partitions at some point).

Note that under EFI, GRUB does not boot Windows from a Windows partition; rather, it chainloads the Windows boot loader, which is stored on an ESP. The ESP, by definition, uses FAT, not NTFS, so the messages about NTFS errors is a red herring, at least for your immediate boot problems. (See my "Issue 2" below, though.) Because update-grub is used on both BIOS-based and EFI-based installations, it may attempt to scan your NTFS volumes, but that's pointless on an EFI-based system.

Note that when you re-install one OS's boot loader, that boot loader will become the default. Thus, it's best to repair Windows first, and only then fix Linux. Because you're probably using GRUB as a boot manager (to control which OS to boot) as well as a boot loader, if you go in the other order, you'll need to adjust the boot order after you fix Windows. You can do this with EasyUEFI in Windows; or by booting a Linux emergency disk and using efibootmgr, and in particular its -o option. Some EFIs also enable you to adjust the boot order using options in their setup utility, but details of how to do this vary from one computer to another.

Looking to the future, I strongly recommend you back up your ESP. With a backup in place, recovering from this type of problem becomes much easier. EFI-mode booting involves accessing files on a FAT filesystem, so a simple file-level backup (using cp, zip, tar, or similar tools) is perfectly adequate. The ESP is small, so you can probably store a backup on a USB flash drive.

Issue 2: Windows Hibernation

The message about Windows hibernation is unrelated to your current boot problem; however, it reveals an equally important issue. Specifically, hibernation in a dual-boot environment is likely to create problems. By leaving filesystems in an inconsistent state, hibernating one OS makes the other OS unable to access that filesystem; and if it tries to do so, filesystem damage can result. Unfortunately, Windows 8 and later turn shutdown operations into hibernate operations, in the interest of reducing boot times. Thus, it's imperative that you disable this "Fast Startup" feature, as it's called in Windows. For Windows 8, instructions on disabling Fast Startup can be found here, among other places. For Windows 10, see here; but also be sure to disable Hibernate in Windows 10, as described here.

Note that the Linux ntfsfix utility does not actually perform any significant repairs; it only does the most basic repairs and then flags the filesystem as requiring attention in Windows. Thus, the usefulness of ntfsfix is limited at best.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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