Jump to content











Photo
- - - - -

A Grub4DOS mountable VHD used to boot Windows from GPT BIOS?


  • Please log in to reply
11 replies to this topic

#1 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 24 posts
  •  
    Vietnam

Posted 08 June 2017 - 03:09 AM

http://www.rmprepusb...s/bios_gpt_boot

 

I'm following the above tutorial, but currently I'm stuck because Grub4DOS unable to mount boot VHD. How can I create mountable VHD?

 

This is the VHD I've used to mount

 

https://drive.google...MTVuVFNBdGZ3Tm8

 



#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 6597 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 08 June 2017 - 03:21 PM

I don't see any mention of VHDs in that tutorial?

You will need to explain better.



#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13576 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 08 June 2017 - 04:53 PM

Yep, that tutorial doesn't mention anywhere a VHD. 

 

A VHD intended to be mounted by grub4dos needs to be of the "fixed" type (i.e. a RAW image) of a whole disk, but your image seems just fine.

 

It is seemingly a normal MBR style image with the normal Windows 7+ boot files (for BIOS), i.e. BOOTMGR and \boot\BCD.

 

Please detail the issue at hand.

 

:duff:

Wonko



#4 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 24 posts
  •  
    Vietnam

Posted 09 June 2017 - 03:08 AM

I don't see any mention of VHDs in that tutorial?

You will need to explain better.

 

Hi Steve, I'm using VHD instead of only using EFI partition so that bcdedit.exe, msconfig, power saving and windows update works, according to cdob

 

 

Another observation at Windows 7 or Windows 8:
regedit.exe: unload HKLM\BCD00000000
bcdedit.exe lists a output.
There is HKLM\BCD00000000 at registry. 

Conclusion:
Windows remembers \boot\bcd device. And reloads the file automatically!

Windows store boot disk configuration somehow.
I suspect MBR signature and checksum still http://www.911cd.net...showtopic=21242

Theory: As for BIOS GPT boot from boot.vhd:
it's not time critical to mount boot.vhd early
boot.vhd can be mounted late
windows native drivers (obviously properly signed drivers) are sufficient:
create a start up script to mount boot.vhd


Given a 24 mb \Windows\Boot.vhd, one activce partiton, filled with bcdboot.exe
menu.lst


title /Windows/Boot.vhd
map () (hd1)
cat --length=0 /Windows/Boot.vhd || find --set-root /Windows/Boot.vhd
map /Windows/Boot.vhd (hd0)
map --hook
root (hd0,0)
chainloader /bootmgr.
Assign Computer Startup Scripts https://technet.micr...y/cc770556.aspx
Windows 8.1 Logon Script Delay Group Policy Setting http://blogs.technet...cy-setting.aspx

powershell.exe Mount-DiskImage -ImagePath c:\windows\boot.vhd -NoDriveLetter.
Windows does boot.
bcdedit.exe, msconfig, power saving and windows update works.

 

 

Yep, that tutorial doesn't mention anywhere a VHD. 

 

A VHD intended to be mounted by grub4dos needs to be of the "fixed" type (i.e. a RAW image) of a whole disk, but your image seems just fine.

 

It is seemingly a normal MBR style image with the normal Windows 7+ boot files (for BIOS), i.e. BOOTMGR and \boot\BCD.

 

Please detail the issue at hand.

 

:duff:

Wonko

 

I tried to mount the VHD with grub4dos from a fairly small NTFS partition (50 MB) (even using a larger partition (12GB) does not work)

 

using VirtualBox ver 5.1.6 r110634

GRUB4DOS 0.4.00)a 2016-12-23

grub> map (hd0,1)/boot.vhd (fd0)

info: total_sectors calculated from partition table(48195) is less than the number of sectors in the whole disk image(49153)

 

probed C/H/S = 3/25563, probed total sectors = 48195

grub> map --hook

grub> root (fd0)

 

error 17:(http://grub4dos.chenall.net/e/17)

              Cannot mount selected partition



#5 cdob

cdob

    Gold Member

  • Expert
  • 1324 posts

Posted 09 June 2017 - 04:02 AM

There is a difference:

map /Windows/Boot.vhd (hd0)
grub> map (hd0,1)/boot.vhd (fd0)

hd0 is not fd0: The suggestion was to use hard disk like image, not a floppy like image.
Create boot.vhd at diskpart.exe. Create a primary patition and set active.

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13576 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 09 June 2017 - 04:45 PM

@wean_irdeh

The quote you made of cdob's post does NOT mention anywhere a (fd0).

So not only you are not following Steve6375's tutorial , but not even cdob's ones.

 

The image you posted a link to has these characteristics:

1) it is a partitioned hard disk image (good)

2) the only partition (NON active) starts 0/2/3 and ends 2/174/44, LBA 128, 43008 sectors

3) its PBR has geometry 255/63

4) as grub4dos told you, you have excess sectors after the end of the partition (you should have just one, the VHD footer) (128+43008)=43136*512=22,085,632

5) and BTW it is NOT 50Mb in size, it is (exactly) 25,166,336 bytes

 

On most BIOSes (including evidently the Virtualbox one) such a small device won't have a 255/63 geometry, you may need to pass the cylinders and sectors  parameters to grub4dos to mount it, but what is the point? (you should NOT map the partition to a floppy device anyway).

 

:duff:

Wonko



#7 cdob

cdob

    Gold Member

  • Expert
  • 1324 posts

Posted 09 June 2017 - 05:47 PM

and windows update works

There are limitations at BIOS to GPT boot still:
a relase update fails. Example: Windows 10 1607 to 1703

Keep the clover boot media still.

#8 Zoso_The_Internet_Tard

Zoso_The_Internet_Tard

    Silver Member

  • Advanced user
  • 536 posts
  • Interests:An investigation is underway to determine whether Trump has any ties to America.

Posted 10 June 2017 - 12:40 AM

To be clear, what cdob is saying is that is *upgrading* (not a "normal" update) from build 1607 to 1703 will fail in a BIOS on GPT configuration. This would also apply to something like upgrading from an earlier Insider Preview to a newer one (IPs are already risky as-is, I wouldn't use something like this with them). Any "normal" update (like security, which doesn't normally change the build #) should theoretically go through fine. Pay careful attention to the updates you're installing (and use WUMT, instead of the normal Windows Update mechanism, it gives you fine-grained over exactly what you do/don't want to install).

I had a situation recently where I had marked my EFI system partition (on GPT) with the flags of "boot, legacy boot, esp" in Gparted. The first and third are normal and assigned by default, but adding legacy boot flag apparently causes Windows to not be able to finish installation (I was using a script to move C:\Users to another drive, but the setup wizard would never finish, it gets (almost) to the create user part but then reboots, rinse and repeat. By removing that flag it was able to finish, I'm guessing it causes something to get confused in regards to whether one is booting from legacy or UEFI. I set that flag again later, in day to day operation everything works as long as something like an upgrade/repair/refresh/reset isn't initiated, including "normal" updates. The whole point of this was to be able to boot in either pure UEFI, or emulated UEFI with Clover/DUET.

@cdob: I'm wondering if you can take at my recent thread at:

http://reboot.pro/to...-gpt-partition/

I had brought up using a vhd for booting Windows in BIOS, but Wonko essentially dismissed it as irrevelant. But if msconfig, power saving, etc work with this approach then it seems the superior way to go (so a single Windows 10 install can be booted in pure UEFI, emulated UEFI with Clover, or legacy with the VHD). Can the vhd be placed in the EFI partition, or does it need its' own NTFS partition (C drive will be encrypted so not suitable)? I had tried creating a vhd in the efi partition but diskpart wouldn't allow it, apparently a vhd can't be created in a fat32 partition.

#9 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13576 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 10 June 2017 - 09:40 AM

I had brought up using a vhd for booting Windows in BIOS, but Wonko essentially dismissed it as irrevelant. But if msconfig, power saving, etc work with this approach then it seems the superior way to go (so a single Windows 10 install can be booted in pure UEFI, emulated UEFI with Clover, or legacy with the VHD). Can the vhd be placed in the EFI partition, or does it need its' own NTFS partition (C drive will be encrypted so not suitable)? I had tried creating a vhd in the efi partition but diskpart wouldn't allow it, apparently a vhd can't be created in a fat32 partition.

Naah, Wonko didn't dismiss it, there is the usual miscommunication problem.

 

The post just after the one Wean_Irdeh quoted, this one:

http://reboot.pro/to...o-gpt/?p=193407

provides exact, step by step instructions by cdob on how to create a suitable boot.vhd and test it, but you introduced the added complication of the encryption and instead of the "fake partition" method I suggested you the UMBR which is a later bettering/simplifying of the setup and Clover, that - if it works on your hardware - is simpler (and is reported by Steve6375 as working with bitlocker too).

 

And yes, you either need another partition for the boot.vhd or you need to put it into the ESP one, but you will need to have a drive letter applied to it, otherwise this:

PowerShell.exe Mount-DiskImage -ImagePath c:\windows\boot.vhd -NoDriveLetter

 

won't work.

BTW the cdob's tutorial uses a 24 Mb vhd, not a 128 Mb one.

 

About the diskpart issue you report when creating the VHD, you can create it elsewhere and later copy it to the ESP partition (which again needs to have a drive letter assigned).

 

:duff:

Wonko



#10 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 24 posts
  •  
    Vietnam

Posted 10 June 2017 - 05:19 PM

@wean_irdeh

The quote you made of cdob's post does NOT mention anywhere a (fd0).

So not only you are not following Steve6375's tutorial , but not even cdob's ones.

 

The image you posted a link to has these characteristics:

1) it is a partitioned hard disk image (good)

2) the only partition (NON active) starts 0/2/3 and ends 2/174/44, LBA 128, 43008 sectors

3) its PBR has geometry 255/63

4) as grub4dos told you, you have excess sectors after the end of the partition (you should have just one, the VHD footer) (128+43008)=43136*512=22,085,632

5) and BTW it is NOT 50Mb in size, it is (exactly) 25,166,336 bytes

 

On most BIOSes (including evidently the Virtualbox one) such a small device won't have a 255/63 geometry, you may need to pass the cylinders and sectors  parameters to grub4dos to mount it, but what is the point? (you should NOT map the partition to a floppy device anyway).

 

:duff:

Wonko

 

Hi Wonko,

My mistake, I got mixed up between steve and cdob's tutorial, hence the (fd0) instead of (hd0) ones. But no matter how much VHD I have made on disk management, it ended up always failing (not mountable on grub4dos) not even after I marked the partition active. Can you send me your own small mountable VHD for booting please?
 



#11 wean_irdeh

wean_irdeh

    Newbie

  • Members
  • 24 posts
  •  
    Vietnam

Posted 11 June 2017 - 12:14 AM

My bad, the reason why grub4dos cannot mount my VHD is because I'm accessing the VHD like a floppy (root (hd1)) rather than access the partition instead (root (hd1,1)). Also, creating VHD in VirtualBox helps me avoiding any excess sector other than VHD footer. Memdisk works too, if MBR assigned. Now I can bypass grub4dos easily and use grub2 directly and booting Windows from GPT in BIOS mode (even VHD booting works). Thanks to anyone who has helped me @steve6375 @Wonko the Sane @cdob @Zoso_The_Internet_Tard


Edited by wean_irdeh, 11 June 2017 - 12:31 AM.


#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 13576 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 June 2017 - 10:32 AM

All is well that ends well :).

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users