1

I dual boot with Ubuntu 19.10 and Windows 10. The drive was partitioned as:

dev/sad1 (8GB swap)
dev/sda2 (~50MB EFI Partition, containing UEFI files for both Ubuntu and Windows)
dev/sda3 (~450GB mounted as root partition, ext4 filesystem)
dev/sda4 (~20MB Windows system reserved partition)
dev/sda5 (~130GB Windows 10 Partition, C drive, NTFS filesystem)
dev/sda6 (~400GB mounted as home (/home), ext4 filesystem)

While installing Pop OS in place of Ubuntu, Pop recommended an EFI partition of ~500MB so I Deleted dev/sda3 (partition mounted as root) and tried to extend the EFI partition. GParted extended the partition but "failed to extend the filesystem". So dev/sda2 was now 500MB with ~50MB of FAT32 filesystem in it. I then went on to install Pop OS in a newly created ext4 filesystem on dev/sda3 leaving 100GB of unallocated space after dev/sda3 and before Windows reserved system partition on dev/sda4. I want to expand the primary partition of Windows from ~130GB to ~230GB.

After the installation of Pop OS the partitions look like this:

dev/sad1 (8GB swap)
dev/sda2 (~500MB EFI Partition, containing UEFI files for Pop OS.)
dev/sda3 (~350GB mounted as root partition, ext4 filesystem)
Unallocated space (~100GB)
dev/sda4 (~20MB Windows system reserved partition)
dev/sda5 (~130GB Windows 10 Partition, C drive, NTFS filesystem)
dev/sda6 (~400GB mounted as home (/home), ext4 filesystem)

I was under the impression that Pop OS installer would detect the UEFI Files for Windows installation and would place the UEFI files in the EFI/Microsoft folder in the correct place But it did not! And now I am stuck with non-bootable Windows installation. The EFI partition only contains Pop OS UEFI files.

I came across a tutorial which shows that copying the Microsoft folder from Windows EFI partition to Pop OS EFI Partition would allow the Pop OS bootloader Systemd-boot to show Windows as a boot option but there is no EFI partition for Windows. Earlier there was an EFI partition for grub where said files were located but Pop OS installer overwrote them and I do not have a backup of the old EFI Partition.

I know from this question that the contents of /boot/EFI/Microsoft look like this:
(Notice contents inside Microsoft folder)

❯❯❯ tree -L 4 /boot
/boot
├── e0dbb6ba929948f599abce57c8e2eb65
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Microsoft
│   │   ├── Boot
│   │   │   ├── BCD
│   │   │   ├── BCD.LOG
│   │   │   ├── BCD.LOG1
│   │   │   ├── BCD.LOG2
│   │   │   ├── bg-BG
│   │   │   ├── bootmgfw.efi
│   │   │   ├── bootmgr.efi
│   │   │   ├── BOOTSTAT.DAT
│   │   │   ├── boot.stl
│   │   │   ├── cs-CZ
│   │   │   ├── da-DK
│   │   │   ├── de-DE
│   │   │   ├── el-GR
│   │   │   ├── en-GB
│   │   │   ├── en-US
│   │   │   ├── es-ES
│   │   │   ├── es-MX
│   │   │   ├── et-EE
│   │   │   ├── fi-FI
│   │   │   ├── Fonts
│   │   │   ├── fr-CA
│   │   │   ├── fr-FR
│   │   │   ├── hr-HR
│   │   │   ├── hu-HU
│   │   │   ├── it-IT
│   │   │   ├── ja-JP
│   │   │   ├── kd_02_10df.dll
│   │   │   ├── kd_02_10ec.dll
│   │   │   ├── kd_02_1137.dll
│   │   │   ├── kd_02_14e4.dll
│   │   │   ├── kd_02_15b3.dll
│   │   │   ├── kd_02_1969.dll
│   │   │   ├── kd_02_19a2.dll
│   │   │   ├── kd_02_1af4.dll
│   │   │   ├── kd_02_8086.dll
│   │   │   ├── kd_07_1415.dll
│   │   │   ├── kd_0C_8086.dll
│   │   │   ├── kdstub.dll
│   │   │   ├── ko-KR
│   │   │   ├── lt-LT
│   │   │   ├── lv-LV
│   │   │   ├── memtest.efi
│   │   │   ├── nb-NO
│   │   │   ├── nl-NL
│   │   │   ├── pl-PL
│   │   │   ├── pt-BR
│   │   │   ├── pt-PT
│   │   │   ├── qps-ploc
│   │   │   ├── Resources
│   │   │   ├── ro-RO
│   │   │   ├── ru-RU
│   │   │   ├── sk-SK
│   │   │   ├── sl-SI
│   │   │   ├── sr-Latn-RS
│   │   │   ├── sv-SE
│   │   │   ├── tr-TR
│   │   │   ├── uk-UA
│   │   │   ├── winsipolicy.p7b
│   │   │   ├── zh-CN
│   │   │   └── zh-TW
│   │   └── Recovery
│   │       ├── BCD
│   │       ├── BCD.LOG
│   │       ├── BCD.LOG1
│   │       └── BCD.LOG2
│   └── systemd
│       └── systemd-bootx64.efi
├── initramfs-linux-fallback.img
├── initramfs-linux.img
├── intel-ucode.img
├── loader
│   ├── entries
│   │   └── arch.conf
│   ├── loader.conf
│   └── random-seed
├── System Volume Information
│   ├── AadRecoveryPasswordDelete
│   └── ClientRecoveryPasswordRotation
└── vmlinuz-linux

Which looks similar to this directory structure (in C:\Windows\Boot\EFI):

akshatfs@apollo:/media/akshatfs/C82CBFC42CBFAC36/Windows/Boot/EFI$ tree -L 3
.
├── bg-BG
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── bootmgfw.efi
├── bootmgr.efi
├── boot.stl
├── cs-CZ
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── da-DK
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── de-DE
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── el-GR
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── en-GB
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── en-US
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── es-ES
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── es-MX
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── et-EE
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── fi-FI
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── fr-CA
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── fr-FR
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── hr-HR
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── hu-HU
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── it-IT
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── ja-JP
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── ko-KR
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── lt-LT
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── lv-LV
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── memtest.efi
├── nb-NO
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── nl-NL
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── pl-PL
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── pt-BR
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── pt-PT
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── qps-ploc
│   └── memtest.efi.mui
├── ro-RO
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── ru-RU
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── sk-SK
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── sl-SI
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── sr-Latn-RS
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── sv-SE
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── tr-TR
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
├── uk-UA
│   ├── bootmgfw.efi.mui
│   └── bootmgr.efi.mui
├── winsipolicy.p7b
├── zh-CN
│   ├── bootmgfw.efi.mui
│   ├── bootmgr.efi.mui
│   └── memtest.efi.mui
└── zh-TW
    ├── bootmgfw.efi.mui
    ├── bootmgr.efi.mui
    └── memtest.efi.mui

Which made me wonder if files in EFI partition of Windows are also located somewhere in primary partition of Windows, specifically inside C:\Windows\Boot\EFI\

And hence my questions:

  1. Where is EFI partition data for Windows 10 located in C drive, if any?
  2. If YES, which ones should I copy and where to?
  3. If NO, are there any other ways to fix this issue which does not require downloading a Windows iso file, I have limited bandwidth and downloading a ~5GB file is not feasible.
  4. I want to expand the primary partition of Windows from ~130GB to ~230GB.
3
  • In my case it is not on C: Drive. Open diskmgmt.msc. I have a separate partition, 100MB in size and named as EFI partition. Commented May 26, 2020 at 8:04
  • You may be able to find a (community-made) Windows-based rescue CD/DVD/USB that contains all the required tools (mainly bcdboot) and isn’t as large as a full-blown Windows Setup medium.
    – Daniel B
    Commented May 26, 2020 at 10:22
  • Windows has a backup of the boot files at %WinDir%\Boot\EFI. Once copied over, you'll then need to recreate the BCD store from WinPE/WinRE via: bootrec /fixmbr && bootrec /rebuildbcd
    – JW0914
    Commented May 26, 2020 at 12:58

2 Answers 2

1

Much like systemd-boot or GRUB is a boot manager which needs an 'entries' file or a grub.cfg telling it what to boot, Windows Bootmgfw.efi is also a boot manager that needs a config file telling it which OS to boot. So it is not enough to just copy the files, you also have to create the configuration.

The officially provided tool for installing a Windows bootloader into a new EFI partition is bcdboot. Start it from a Windows installation disk (CD or USB) – you don't need to go through the menus, just press Shift+F10 to access the console window:

bcdboot c:\windows

This will copy all static bootloader files from the specified source (the ones that you found) into the proper place, but it will also generate the configuration file (the BCD) for the Windows Bootmgr, and it will also add the new partition's GUID to the EFI boot menu.

(Creating a bootable USB stick from Windows ISO easily done on Linux, but covered by existing threads. Just be sure that you create a UEFI-bootable one, and that you boot it in EFI mode, so that bcdboot will default to installing an EFI bootloader. Although bcdboot has an option to choose which bootloader to install, anyway.)

0

Pop!_OS installer would normally just add its files to ESP (EFI System Partition). You may have accidentally chosen to format it during installation or it was damaged when resizing failed. The standard course of action in this situation is to restore from backups. Let this be a lesson: make regular backups of entire system (partition images for non-data drives) and make additional backups immediately before messing with partitions. And if something goes wrong in the process, try to understand the problem and fix it instead of continuing!

The repair is possible without Windows ISO You can find most needed files in the Windows folder, but you'll have to generate boot configuration store for your specific system. You'll need some kind of Windows recovery environment to do this, preferably ISO of the same Windows version which you have installed. Older builds of Windows 10 didn't use hybrid 32/64-bit ISOs, so if your bandwidth is limited you could consider downloading them (if you can find trusted sources, because Microsoft doesn't provide them anymore).

Boot files are located in C:\Windows\Boot\EFI. You have to copy them to <ESP>\EFI\Microsoft\Boot. You may also have to add the bootloader file to UEFI boot list. You can do this in UEFI setup. The bootloader binary is called bootmgfw.efi.

Boot configuration store can be generated by executing bootrec /rebuildbcd in the <ESP>\EFI\Microsoft\Boot directory.

I've used this website to refresh my memory. I've done this repair in the past and I can confirm this method worked.

3
  • 1
    Copying the files is not enough, without the BCD, Windows will not boot. I don’t think there’s any way to create the BCD from Linux.
    – Daniel B
    Commented May 26, 2020 at 8:50
  • Ahh, unfortunately you're right. I forgot that it's stored on ESP too. I'll update the answer...
    – gronostaj
    Commented May 26, 2020 at 8:57
  • @gronostaj You are actually right. I did choose to format the ESP and forgot about it (I don't know what was I thinking, obviously Windows EFI files will be deleted). Also I'll try to make backups a habbit. However I have one small doubt, I have edited the question to ask. Thanks for your answer.
    – akshatfs
    Commented May 26, 2020 at 12:33

You must log in to answer this question.

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