5

My computer is configured for dual-booting via Grub. I run Windows 10 and Ubuntu 17.10.

Earlier today I was working in Ubuntu and I ran out of space on my ext4 partition. Wanting to make it larger, I first needed to shrink my Windows boot partition.

I used ntfsresize to shrink the filesystem (which it did with no errors) and then fdisk to delete and recreate the partition. I was aware that ntfsresize and fdisk disagree about MB vs MiB, and to compensate I checked the 'bytes' value in the output of ntfsresize and converted this into KiB, then used this value in fdisk. When it asked me if I wanted to remove the existing NTFS signature I said no. I set the drive type to 11 (Microsoft basic data). Due to my drive using GPT I wasn't able to mark the drive as bootable within fdisk, so I opened parted and changed it there instead.

Following all this I tried to reboot into Windows to run chkdsk, but instead of booting into Windows, Startup Repair was automatically launched. It said it was unable to automatically repair Windows. I opened the recovery Command Prompt, and my drive is detected and mounted. (Although it's mounted as E: instead of C:) I ran chkdsk E: /F and it completed successfully. I can see all the files on it. I tried running bootrec /FixMbr which seemed to work, bootrec /FixBoot which gave an "Access is denied" error, and bootrec /RebuildBcd which was able to detect my Windows installation and add it to the BCD.

However after all of this, every time I try to boot Windows it just launches Startup Repair. I can still boot into Ubuntu, and I'm even able to mount my C drive as read-write using ntfs-3g.

What could I be missing? Why is Windows refusing to boot, even though the partition seems healthy?

Thanks in advance!

EDIT: Here's my boot-repair output: http://paste.ubuntu.com/p/YCkzCcNdkN/

2
  • I am not 100% sure, but I think the boot partition is a special type and windows won't boot if its not that type. Also, if you removed the boot partition and recreated it, have you moved its content back?
    – LPChip
    Commented Oct 24, 2018 at 9:38
  • In fdisk if you remove a partition the data remains. Creating a partition with the same starting sector will mean the data is present on the new partition. I can view the data within the new partition in both Linux and Windows Recovery. It just won't boot. :( Commented Oct 24, 2018 at 11:31

4 Answers 4

8

I did the same (ntfsresize + fdisk) while installing linux, and ran into the same problem. Eventually, this seems to work, from the Windows recovery prompt:

fixboot /scanos

it found c:\windows, then I ran:

bcdboot c:\windows

I also ran chkdsk c:, fixboot /mbr and bcdedit /set {default} recoveryenabled no before that, but I do not think they are related to the problem.

As far as I understand, the bcdboot command above, added the option of booting to the new c:\windows for bootmgfw.efi. Indeed, after rebooting I had two options:

  1. the new "windows 10, on partition 3", which worked, and

  2. "windows 10", which did not (as before).

Once booted, I removed the non-working option from the configuration manager (search "configuration manager", tab "boot").

Reference: [https://docs.microsoft.com/en-us/windows/client-management/advanced-troubleshooting-boot-problems][1]

5
  • Nice! I ended up reinstalling Windows so I can't test this, but this seems like it probably would've solved the problem. Commented May 21, 2019 at 12:21
  • 3
    Thanks! fixboot was not a recognized command, but bcdboot c:\windows did the trick! Commented Mar 1, 2021 at 11:50
  • 1
    bcdboot X:\Windows works even after deleting and recreating the boot partition without backup. Works fast too Commented Feb 23, 2022 at 12:15
  • Tried to do it this way but the Command Prompt from the Troubleshooting section of the "Repair your computer" section of the bootable Windows 10 install ISO says it doesn't know what "fixboot" is. Doing the bcdboot step without the fixboot step did change a little something for the better but still didn't make Windows bootable again after the system partition resize. Is this command propmpt on the install disk not equivalent to what you're calling the Windows Recovery Console?
    – Don Joe
    Commented Mar 4, 2023 at 10:30
  • @sgerwk Ah, it seems you may have been using a boot CD for an older version of Windows, as newer versions no longer have what used to be called the "Windows Recovery Console", and also your linked article which applies to Windows 10 doesn't mention the command "fixboot" anywhere (though it does mention "bootrec /fixboot"). lifewire.com/recovery-console-2625991
    – Don Joe
    Commented Mar 4, 2023 at 10:43
1

Boot from Windows live cd and run chkdsk /f/x/r.

I booted from Linux boot cd and used gparted for check but that did not help. Then I ran ntfsfix but drive was still not accessible. Then I booted from Windows live cd and ran chkdsk /f/x/r and drive became accessible.

1

I always repeat that the Windows disk should only be resized from Disk Management, because Windows will not allow a destructive resize, which is what happened here.

As the automatic repair does not work, boot the Repair Startup into Command line mode, and enter the following commands :

diskpart
list disk
select disk X        (X is the disk containing Windows)
list partition
select partition X   (X is the partition number where Windows is installed)
active
exit

If this does not work, and a better solution doesn't come up, a reinstallation of Windows will be required.

5
  • "The selected disk is not a fixed MBR disk. The ACTIVE command can only be used on fixed MBR disks." Commented Oct 24, 2018 at 11:29
  • @JoshuaWalsh: The poster did "bootrec /FixMbr which seemed to work".
    – harrymc
    Commented Oct 24, 2018 at 11:33
  • I am the poster. Doing bootrec /FixMbr says "The operation completed successfully." But when I run the commands you sent, I get the error from my comment. Commented Oct 25, 2018 at 9:01
  • 2
    Your disk is GPT, so the above advice doesn't apply and I don't really know what did "bootrec /FixMbr". I suggest doing a Windows 10 In-place Upgrade and not one of grub. This will most probably destroy grub, which will have to be repaired or reinstalled. If this doesn't work, then there is a serious problem.
    – harrymc
    Commented Oct 25, 2018 at 11:14
  • This answer put me on the right track even though I couldn't use your commands because I also had GPT. I used GParted to move to the left the EFI, MS Reserved and System partitions and to resize the System partition, and then it would't boot or get repaired with any of the advice on this page. What worked was restoring from backup, moving partitions left with GParted with no resize, then booting to Windows and extending the System partition C: using Disk Manager. That worked smoothly and now I have a larger Windows 10 partition using extra space I had originally freed up to the left of it.
    – Don Joe
    Commented Mar 6, 2023 at 14:52
1

I noticed that when I tried to shrink the Windows system partition using the GParted tool, the free space shown in Linux was different from the free space in Windows.

I can't explain technically how this happens, but in general terms, when reducing the partition using Windows, a portion of space is kept for 'Windows reserved storage.' Since Linux doesn't recognize this format, data loss occurs when shrinking the partition with GParted.

I conducted tests using a virtual machine, and after following the procedures from the link below to disable 'Windows Reserved Storage,' I managed to shrink the partition size in Linux, and the operating system could boot without any issues. Link on how to disable: here"

For the impatient ones:

dism /Online /Set-ReservedStorageState /State:Disabled

You must log in to answer this question.

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