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/

5 Answers5

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]

sgerwk
  • 96
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.

harrymc
  • 498,455
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.

somebadhat
  • 1,240
AID
  • 11
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
1

Just ran into this, with GPT disks, none of the above solutions worked. I had to use DiskPart, find and select the volume that contained my Windows installation, and saw that it was drive E not C, my data partition was C somehow. Select data partition, assign LETTER=Z to free up letter C, and select windows partition and assign LETTER=C. After that, bcdboot c:/Windows worked and I could see my drive in BIOS again.