Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

VHD Native Boot with Junctions


  • Please log in to reply
21 replies to this topic

#1
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

I've been trying to do something interesting with native VHD boot.

 

I create a new VHD, and then move my Windows folder off of the physical partition, onto the VHD. I do this using a program that preserves security and hard links on files, so everything is "original".

 

I then create junctions from the VHD for Program Files, Users, and ProgramData.

 

Then I create a boot entry pointing to my VHD. Unfortunately, the boot just doesn't seem to work.

 

Has anybody tried to do anything like this? I've been at it for a few weeks now, without much progress. I did get this working with physical partitions before, so I know the junctions aren't the issue.

 

Are there any particular gotcha's with this process? I've tried bootsect /nt60 z: /force /mbr, bcdboot z:\windows, both [locate] and the physical drive path of the VHD with bcdedit, all to no avail.

 

I've fixed up partition letters in the MountedDevices registry key, all to no effect.

 

The Windows 8 spinner never shows, and the boot consistently fails.

The same method does succeed when I clone my OS into the VHD using some kind of disk cloning software. There's some extra stuff that the disk cloning software does, apparently, but I haven't been able to figure it out, even despite comparing registries.

 

Does the VHD have to be created a particular way? I've even tried both GPT and MBR partitions.




How to remove advertisement from MSFN

#2
dhjohns

dhjohns

    Newbie

  • Members
  • 23 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Read this.  http://www.johnpapa.net/bootoffmetal/



#3
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Not trying to boot off of bare metal. I already have my OS loader on hidden MS partitions.



#4
dhjohns

dhjohns

    Newbie

  • Members
  • 23 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

If you are running Windows installed normally, and you have a vhd which is on your hard drive, then you just mount it from your normal OS.  I use EasyBCD, and then open it, and assign the new vhd to the boot menu.



#5
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

I've tried that and similar to no avail. I think the key distinction here is that I am creating a blank VHD, formatting it with NTFS, manually copying the Windows folder preserving permissions, also transferring bootmgr to the root of the new VHD (mounted as Z:), and then creating the junctions to the original root drive (which also contains the VHD). Unfortunately, I must be missing something for the boot to work - because it is just not happening with this approach. As I've written earlier, it is not a problem to add the VHD to the boot menu. A cloned VHD can be added to the boot menu and it works. I am trying to do this without cloning, and it is not working.



#6
dhjohns

dhjohns

    Newbie

  • Members
  • 23 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

You might be better off just to use a program to create a vhd from a physical drive.  Or you can do a fresh installation on the vhd.  I am sure you thought of that, but unless you are really trying to solve this problem it might be the easiest and quickest approach.



#7
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Yes of course. However, my requirements dictate that I do this in the way that is described. So I need to know what steps/actions I need to undertake to ensure that the resultant VHD is bootable normally.

 

BTW, my condolences on the passing of Gabriel Garcia Marquez. Was a favorite author. May he rest in peace and in magical realism!



#8
dhjohns

dhjohns

    Newbie

  • Members
  • 23 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Thank you for condolences.  I am sorry I can't help you any further with your issue.  You may want to create a free account at beyondwindows9.com  as they have some real tech gurus there who may help.  There is also a VIP membership for sale (real cheap.)  It may be worth your while.  I would try that forum though.  I have had some real issues, and received excellent results. 



#9
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Thanks for the suggestion. I suppose no one else here has any feedback or experience with the issue?



#10
parth3b

parth3b
  • Members
  • 7 posts
  • OS:Windows 7 x86
  • Country: Country Flag

@simonking have you tried creating vhd in vmware or sun virtual box and then install os into that vhd and than use that vhd for boot than it will work 



#11
jaclaz

jaclaz

    The Finder

  • Developers
  • 13,445 posts
  • OS:none specified
  • Country: Country Flag

Thanks for the suggestion. I suppose no one else here has any feedback or experience with the issue?

Maybe you could expand a little on:

  • Why exactly you want or need this particular setup (i.e. what is the intended final goal)
  • What exactly you have tried, exact meaning exact, as opposed to "vague", i.e. "I used program xy wit this specific command line w z as opposed to a program that preserves security and hard links on files, so everything is "original"

Right now I cannot understand what is your expected final result :unsure:.

 

jaclaz



#12
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Let's say there's a generic Windows installation with the C: partition containing the OS and the program files, users, etc. folders. Since this is a generic Windows installation, the BCD store will be located on the hidden boot partition as typically created by Windows setup (my current development case), or it may also be located on the C: partition itself (I have not yet tested this scenario, but hope to eventually arrive at it as well, once my current setup succeeds).

 

The final goal is to:

 

- Create a VHD on the C: partition, and mount it as drive Z:.

- Move the Windows folder from the C: partition to drive Z:.

- "Mount" the remaining program files, users, etc. folders on the Z: drive through directory junctions.

- Update the BCD store with a boot instruction from the VHD.

 

I know the junctions aren't the issue, as I have been able to clone my C: partition on the same system into new partitions called D: and E:, then nuking all folders except Windows on E:, and nuking the Windows folder from D:, and creating junctions from the E: drive to the D: drive for the program files, users, etc. folders. Updating the BCD store with a boot entry for E: and then booting from E: works flawlessly; all programs, user settings remain fully accessible as before.

 

What I have not been able to do is fix all this up inside a single partition, with a VHD created on that partition to host the Windows folder. The VHD boot simply stalls. I am doing my R&D on a Surface Pro 2, so all that happens is that I get the Surface logo (would be the Windows logo on a non-OEM Windows 8.1 install) after opting to boot into the VHD, and then the "spinner" below the VHD just never appears. No error is shown at any time, I can only hard-reset the machine to boot into another partition.

 

I am trying to automate as much of the process as possible, so I am using some APIs to create the VHD and to move the data. If there are any pre-existing third party tools that anybody can get this setup to work with, I would be very happy to try them as well. I have manually verified file security on Windows files and folders, up to and including hard links that are created within the Windows folder - so I know those are not the issue either. But I am happy to provide access to the custom application as well, if you so wish.



#13
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Some more interesting results, fresh in:

 

I created a new VHD, using the same APIs that I have used so far in all my tests, and then I used Paragon Hard Disk Manager 14 to clone my partition C: onto this VHD.

 

Then, I nuked all folders on this VHD, except Windows. I created directory junctions to another copy of my partition C:, let's say P:, for all the program files, users, etc. folders. This VHD boot worked!

 

The only difference between this case, and my fully automated test case that is failing, is that I deleted all folders other than Windows from the cloned VHD, instead of skipping the cloning altogether, and copying Windows instead.

 

Clearly, there's something "a little extra" that Paragon is doing here, to either the partition, or the boot sector, or wherever - that I am missing.

 

Has anybody here succeeded in booting Windows off of a blank VHD with an NTFS partition and accurately copied Windows folder, that is marked bootable as described in my first post, and with directory junctions for the remainder folders?

 

That's really all I have left to figure out.

 

I am next going to remove Windows itself from the Paragon VHD, and copy Windows using my software, to further narrow the issue down.

 

If that works again, I am virtually certain there's some kind of partition tweak/setting that I am missing; because Paragon's clone works, even with my own software's automated API-created VHD.



#14
jaclaz

jaclaz

    The Finder

  • Developers
  • 13,445 posts
  • OS:none specified
  • Country: Country Flag

OK, now I understand better, still I miss why exactly you want to "install to C:\" and later "move" this install "to Z:\" (but leaving the "program files, users, etc. folders" on C:\).

I mean (just an idea) why not installing to the VHD and later move the "program files, users, etc. folders" to C:\?

And, if I get this right, the "final goal" is to have (besides the "boot" partition with the BOOTMGR and the \boot\BCD which may be either a separate one or being your same "C:\") all the actual Operating System, exception made for "program files, users, etc. folders" inside the .vhd while having the "program files, users, etc. folders" still resifding on C:\.

But I am still failing to uinderstand what would be the advantage use of such a setup. :unsure: Saving hard disk space? Allow for a (better) multibooting?

 

As a side note, if you are into Windows 8.1, the new Wimboot approach may interest you (if the scope is to save hard disk space).

Also, more generally, if you capture a Wim image of the C:\ and apply it ot the .vhd, what happens? (without any third party tool and rather simple).

 

jaclaz


Edited by jaclaz, Today, 09:01 AM.


#15
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

I'm happy I was able to explain the scenario.

 

I have a lot of constraints; among these:

 

1) I cannot assume a fresh install will be possible,

2) I cannot assume more than 1 GB of free space will be available,

3) I cannot assume any additional external storage will be available.

 

As such, the approach I have described appears to be the best one. The only problem is, getting the VHD to boot!



#16
jaclaz

jaclaz

    The Finder

  • Developers
  • 13,445 posts
  • OS:none specified
  • Country: Country Flag

I'm happy I was able to explain the scenario.

 

I have a lot of constraints; among these:

 

1) I cannot assume a fresh install will be possible,

2) I cannot assume more than 1 GB of free space will be available,

3) I cannot assume any additional external storage will be available.

 

As such, the approach I have described appears to be the best one. The only problem is, getting the VHD to boot!

Still, nothing tells me which actual advantages you expect from this approach.

 

But it's not my business at all, anyway.

 

What I would do right now if I were you would be to (temporarily) forget about  your approach :w00t: and see if you can find the *whatever* you are missing into the procedures used for native or non-native VHD booting, like:

http://reboot.pro/to...-windows-to-go/

http://reboot.pro/to...ct-make-mini-8/

 

Maybe the step you are missing is correcting/updating the MountedDevices key?

Or *somehow* your procedure changes the Disk Signature of the .vhd?

 

Maybe if instead of "directly" on the Surface2 you try your test inside a "more normal" VM, you can get a BSOD or however an error that could give hint of what is the actual problem.

 

jaclaz



#17
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

I've done MountedDevices manipulations, all to no effect.

 

The results of the latest test are in. When I nuke the Windows folder on the Paragon cloned VHD partition, and copy the Windows folder using my own software anew, the boot still succeeds. So I know:

 

1) The VHD is not the issue, since I created it with my software, even in the Paragon test case that works.

2) The Windows folder is not the issue, since using my software to copy it fresh into the Paragon test case also works.

 

The only remaining issue is the partition. Would you all agree?

 

What could possibly be a factor in creating a partition that might affect this?

 

Any must-have steps?



#18
jaclaz

jaclaz

    The Finder

  • Developers
  • 13,445 posts
  • OS:none specified
  • Country: Country Flag

I've done MountedDevices manipulations, all to no effect.

....

The only remaining issue is the partition. Would you all agree?

 

What could possibly be a factor in creating a partition that might affect this?

 

Any must-have steps?

Things to check are/can be:

  • Disk signature.
  • Offset to active partition (if you prefer partition alignment) and active status
  • Volume serial.
  • Volume label.
  • CHS geometry (but that should not be anympore an issue with Windows Vista and later boot code)

 

Basically all you have to compare are the MBR's and the VBR's of the two .vhd's for any difference, *everything else* is within the "normally accessible" areas of the filesystem and won't make a difference.

 

jaclaz



#19
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Thanks for the information. Here's some output I've taken from the VHD's and Partitions that work and fail.

 

Volume P: - works.

Volume Z: - fails.

 

Disk 1 - VHD for Drive P.

Disk 2 - VHD for Drive Z.

 

Does any of this provide any insight?

Attached Files



#20
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Here's advanced diagnostics on each drive:

 

Drive P: - boots

->Boot Sector

cOEMID: NTFS   

Size: 63320358400 bytes, 60386 Mbytes

TotalSectors: 123672575

SectorsPerTrack: 63

Heads: 255

->Partition_Info Type: 7, Advanced Unix QNX QNX OS/2 HPFS WindowsNT NTFS

->DeviceNumber: 1 PartitionNumber:1 Type:7

->VolumeGUID: \\?\Volume{20c8bc3d-cb37-11e3-8352-281878b6c447}\

->GetDiskFreeSpace

Sectors per cluster: 8

Bytes per sector: 512

ClusterSize: 4096

Total clusters: 15459071 (60386 MB)

Free Clusters: 11313312 (44192 MB) / Used Clusters: 4145759 (16194 MB)

 

Drive Z: - fails

->Boot Sector

cOEMID: NTFS   

Size: 11810045440 bytes, 11262 Mbytes

TotalSectors: 23066495

SectorsPerTrack: 63

Heads: 255

->Partition_Info Type: 7, Advanced Unix QNX QNX OS/2 HPFS WindowsNT NTFS

->DeviceNumber: 2 PartitionNumber:1 Type:7

->VolumeGUID: \\?\Volume{20c8be9a-cb37-11e3-8352-281878b6c447}\

->GetDiskFreeSpace

Sectors per cluster: 8

Bytes per sector: 512

ClusterSize: 4096

Total clusters: 2883311 (11262 MB)

Free Clusters: 30949 (120 MB) / Used Clusters: 2852362 (11142 MB)



#21
jaclaz

jaclaz

    The Finder

  • Developers
  • 13,445 posts
  • OS:none specified
  • Country: Country Flag

One of the two (the one that fails seemingly) has 128 sectors before (unusual but that should not create any issue) and is active whilst the one that works has 2048 (normal alignment nowadays) and is not active (but since the BOOTMGR and \boot\BCD are "elsewhere" it's fine).

 

But you failed to post info about the Disk Signature and the Mounteddevices data you have in the Registry, and the *whatever* you have in your \boot\BCD for the two .vhd's.

 

 

jaclaz



#22
simonking

simonking

    Newbie

  • Members
  • 12 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

The MountedDevices are fixed up for both VHDs. In fact, it even works when I delete all keys under MountedDevices.

 

The Active issue is probably not an issue with the partition that does work, precisely due to the reason that you mentioned.

 

Where can I locate the Disk Signature? Hopefully that is the problem!






1 user(s) are reading this topic

1 members, 0 guests, 0 anonymous users


    simonking


How to remove advertisement from MSFN