Jump to content











Photo
- - - - -

Boot to Windows from a VHD file


  • Please log in to reply
23 replies to this topic

#1 steve6375

steve6375

    Platinum Member

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

Posted 14 June 2017 - 10:18 PM

Here is a grub4dos batch file (could be used in a menu instead) for experimentation.

 

I used a USB drive containing an XP VHD and booted using VirtualBox+DavidB's VMUB (USB attached as an IDE drive).

 

The idea here is that we make a partition #3 table which points into the VHD file at the point where the partition starts. We can then boot directly from partition #3 of the USB disk.

  1. The ISO must be contiguous.
  2. The VHD must contain a single-partition which holds the boot files+OS.
  3. Partition #3 of the USB drive is overwritten in this process.
  4. The ISO may also be modified by grub4dos (boot.ini)
  5. Your VM needs to be read/write (use VBox+VMUB so volume is dismounted and so is truly write-enabled - don't just use a .vmdk for the USB drive).
  6. If booting from a real system, your VHD must support USB-booting.
!BAT
set ISO=()/FullXPVHD.vhd
# get start of first ptn inside VHD
dd if=%ISO% of=(md)0x300+1  > nul
read 0x601c6 > nul
set /a P=%@retval% > nul
echo Partition starts at %P%
# find start of file on USB disk
blocklist %ISO% > (md)0x300+1
cat --locate=+ --replace=\x00 (md)0x300+1 > nul
cat --locate=) (md)0x300+1 > nul
set /a x=%?%+1 > nul
cat --skip=%x% (md)0x300+1 | set /a ST= > nul
echo ST=%ST%
#find length of file
blocklist %ISO% > (md)0x301+1
cat --locate=\x0a --replace=\x00 (md)0x301+1 > nul
cat --locate=+ (md)0x301+1 > nul
set /a x=%?%+1 > nul
cat --skip=%x% (md)0x301+1 | set /a L= > nul
echo L=%L%
# Adjust start position to point to first partition
set /a ST=%ST%+%P% > nul
#set /a L=%L%-%P% > nul
echo -n was
blocklist %ISO%
echo Now         %ST%+%L%
echo
partnew (hd0,2) 7 (hd0,0)%ST%+%L%
ls (hd0,2)/
echo
root (hd0,2)
echo
# if XP adjust boot partition - this modifies the ISO file!
cat --locate=tition(1) --replace=tition(3) (hd0,2)/boot.ini
cat (hd0,2)/boot.ini
echo
chainloader /ntldr || chainloader /bootmgr
pause
boot

I have not tested this using a Win7/8/10 VHD - I am not sure if the BCD would work or not, but the partition UUID would be unaltered....



#2 Guest_AnonVendetta_*

Guest_AnonVendetta_*
  • Guests

Posted 14 June 2017 - 11:03 PM

But.....why as an IDE drive? Isn't that really slow? Why not SATA/AHCI?

#3 steve6375

steve6375

    Platinum Member

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

Posted 15 June 2017 - 07:57 AM

Unless added, XP does not have SATA drivers.



#4 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 15 June 2017 - 01:27 PM

It's nice how seemingly there is NO .iso whatever involved :whistling: , though it is a variation of cdob's method of mapping a .iso extents to a partition or "fake .iso partition":

http://reboot.pro/to...brided/?p=88531

 

Now, given that the .vhd (a "fixed" .vhd, please read as a RAW image file with a descriptor sector appended) has a single partition in it, normally in the MBR first slot (and that conversely an extended partition has in the first slot of the EMBR the address of the first logical volume inside it), what would happen with:

 

partnew (hd0,2) 0x05 (hd0,0)/FullXPVHD.vhd

partnew (hd0,2) 0x07 (hd0,4)+1

 

It should be simpler. ;)

 

I don't think it would make a difference to use 0x0F instead of 0x05 as partiton ID.

 

:duff:

Wonko



#5 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 15 June 2017 - 03:34 PM



It's nice how seemingly there is NO .iso whatever involved :whistling:


i really cant figure out what the goal here is? it do not seem to be what the title suggests to me.

is this a way to install XP or what?

#6 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 15 June 2017 - 04:08 PM

Ow, come on.

 

You have a USB stick.

 

You put on it a .vhd booting a "full XP", like - as an example - one made with Wimb's fine tool:

http://reboot.pro/to...t-make-mini-xp/

 

Then, how do you map and boot it in grub4dos?

 

Using the traditional way using Winvblock, like the above or:
http://reboot.pro/to...tall-xp-in-vhd/

 

Or using this way. i.e. mapping the .vhd (RAW image+added sector) extents to a partition entry in the MBR of the USB stick.

 

This way it is - to all effects - a "real" partition on the USB stick.

 

As always, on real hardware there is the possible need of a filter driver to make the stick a "fixed" disk and there is generically a risk of corruption because the .vhd extents (mapped as partition/volume) are actually inside the "outer" filesystem, or, if you prefer, two partitions overlap partially.

 

Just to make an example, it wouldn't be a such a good idea to defragment the first partition, or to delete the FullXPVHD.vhd from the first volume.

 

Actually it would probably make more sense to use this approach to make a "revolving" stick, a stick that can be set to boot the one or the other partition, hiding the "other" partition (and if needed re-ordering partition entries).

 

BTW, if a logical volume is OK, just this will be enough:

partnew (hd0,2) 0x05 (hd0,0)/FullXPVHD.vhd

to make the .vhd mapped as (hd0,4) (first volume inside Extended).

 

:duff:

Wonko



#7 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 15 June 2017 - 04:43 PM

thnx Wonko. Ive been doing it the other way that you mention. so this way it seems that the .vhd is cloned onto a partition of the USB HDD then booted from there. so before you boot it, it takes time to copy over.

the original .vhd remains unchanged and this new partition saves changes, correct? so the next time you boot, it is not needed to use the .vhd again unless you want to? is this the 'goal'?

#8 steve6375

steve6375

    Platinum Member

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

Posted 15 June 2017 - 05:23 PM

It's nice how seemingly there is NO .iso whatever involved :whistling: , though it is a variation of cdob's method of mapping a .iso extents to a partition or "fake .iso partition":

http://reboot.pro/to...brided/?p=88531

 

Now, given that the .vhd (a "fixed" .vhd, please read as a RAW image file with a descriptor sector appended) has a single partition in it, normally in the MBR first slot (and that conversely an extended partition has in the first slot of the EMBR the address of the first logical volume inside it), what would happen with:

 

partnew (hd0,2) 0x05 (hd0,0)/FullXPVHD.vhd

partnew (hd0,2) 0x07 (hd0,4)+1

 

It should be simpler. ;)

 

I don't think it would make a difference to use 0x0F instead of 0x05 as partiton ID.

 

:duff:

Wonko

 

 

That's much better! I was trying something like that but failed to think of it and did it the hard way!

:thumbup:

 

so we have this which works for me:

title VHD BOOT
# use raw disk image as ptn #2 and set as extended ptn
partnew (hd0,2) 0x05 /FullXPVHD.vhd
# set logical ptn as primary ptn
partnew (hd0,2) 0x07 (hd0,4)+1
root (hd0,2)
echo
# if XP, adjust boot partition - this modifies the VHD file!
cat --locate=tition(1) --replace=tition(3) (hd0,2)/boot.ini
cat (hd0,2)/boot.ini
echo
chainloader /ntldr || chainloader /bootmgr
boot


#9 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 15 June 2017 - 05:46 PM

thnx Wonko. Ive been doing it the other way that you mention. so this way it seems that the .vhd is cloned onto a partition of the USB HDD then booted from there. so before you boot it, it takes time to copy over.

the original .vhd remains unchanged and this new partition saves changes, correct? so the next time you boot, it is not needed to use the .vhd again unless you want to? is this the 'goal'?


nevermind. seems asking what the point or goal of this is too much to ask.

#10 steve6375

steve6375

    Platinum Member

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

Posted 15 June 2017 - 06:00 PM

The partnew VHD schemes above, all cause  it to boot with the USB drive contents in C: and the VHD contents in D:.

 

I suspect that some programs/startup batch scripts, etc, are looking at drive C: (there are no Desktop shortcut icons and it takes a while to boot) also no bliss wallpaper and no system tray balloons.

 

What could we do to make it boot as C: for the system drive but still boot from (hd0,2)?

 

I tried hiding hd0,0 and hd0,1 and also making hd0,2 active but it didn't help.



#11 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 15 June 2017 - 06:42 PM

@zoso

It isn't really "cloned", nothing is "copied" it is simply addressed in the MBR directly (besides being indexed in the filesystem), it takes like a fraction of a second.

Imagine that on the usb stick the (single) partition, NTFS formatted, spans from sector 63 to sector 100,000.

Within the root of that partition the (contiguous) file  /FullXPVHD.vhd will occupy a given extent, let's say from 50,000 to 55,000.

What is done is simply to write that range address (with a suitable partition ID) to the USB stick MBR., that is at the most 16 bytes are written.

 

What happens is that the partition ID's 05 and 0F are the ID's for extended partitions, i.e. partitions where the first sector is a EMBR i.e. with the same four partition entries as the MBR.

The OS (and grub4dos) know that when it finds 05 or 0F it is actually accessing a container of volumes, and the address of the first volume is in the first entry of this EMBR, then it maps this volume as a logical volume inside extended (hd0,4) in grub4dos notation.

 

Next step (optional) is to re-map this logical volume to a primary partition. (another 16 bytes written)

 

Changes to this "partition" will happen on BOTH the partition and the .vhd files, as they are the SAME thing, only addressed differently.

But there won't be any need of Winvblock or of any other Filedisk driver.

 

@steve6375

There will be the usual need to reset dosdevices in the registry, I believe.

If you booted it once with another partition present, the volume will get a non-C drive letter, and that will remain sticky in subsequent boots and even on first boot (without any other partition present) the letter assigning needs to be "clean" otherwise there may be present the disk signature of the VHD MBR (if it was booted as VHD).

 

Ideally one could use (it has to be seen which data/pattern is to be searched and replaced) the cat --hex --replace to set the correct disk signature and offset in the Registry while offline.

 

The good news may be :dubbio: that if you manage to pre-assign the right "C:" drive letter, you can possibly delete the BOOT.INI. 

 



# if XP, adjust boot partition - this modifies the ISO file!

 

There is NO §@ç#ing ISO file!  :ranting2:

 

:duff:

Wonko



#12 steve6375

steve6375

    Platinum Member

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

Posted 15 June 2017 - 07:33 PM

If I swap over  the ptn #1 table with ptn #3 then it boots fine - but this is not really a solution!

 

If ptn #1 (easy2boot)  and ptn #2 (dummy ptn)  table entries are blanked using  

parttype (hd0,0) 0

parttype (hd0,1) 0

 

and boot.ini is set to partition(1)  then it also boots OK.

Also not really a solution as it will not boot to grub4dos again!



#13 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 15 June 2017 - 07:58 PM

interesting.. i suppose there is a good reason to do this besides eliminating WinVblock or firadisk from the setup. possibly (only guessing)so some other features or whatnot that EZ2B provides can also be utilized.

is this new partition a real one or more like a virtual one that would not show up if this USB stick or HDD was inserted into another running system (that was able to 'see' removable disks as fixed)?

DavidB's VMUSB is one of the greatest tools ever. I really hope he is doing well these days and mis seeing his posts here too. yes, i remember why he said he was getting out of it. really cool guy, learned alot from him, was able to do many things that were not possible without VMUSB. cant thank him enough for that.

#14 steve6375

steve6375

    Platinum Member

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

Posted 16 June 2017 - 07:45 AM

Well this could be a way of booting Windows NT6 OS's direct from multiple VHDs (not dynamic) without needing bootmgr and a BCD, etc.

 

E2B can boot directly from XP VHDs and almost directly (uses bootmgr) from Win NT6 VHDs. This was just an experiment for interested parties.

 

The partition entry created is a real one.

On a removable drive, if it is not ptn #1 then it will not be seen unless you are booting Win 10 Redmond 2/Creator which can see all partitions on a removable drive.

 

As far as I can see, using this method for XP is not really going to work (though it could if your grub4dos was kept on partition #2 and you used partition #1 for the 'new' VHD entry).

 

I have not tested with an NT6 VHD yet as I don't have a full VHD (with boot files) made at the moment.

 

I have not heard from DavidB (not his real name) for ages. I use VMUB every day too and it is great!



#15 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 16 June 2017 - 07:57 AM

@steve

But how did you manage the letter assignment?

Once the XP has started booting (past NTLDR) everything should be connected to the DosDevices entries, once the C: drive letter has the "right" disk signature and offset, you should be able to move back the entry to non-first (but this will only work in Virtualbox or similar, on real hardware there will be the issue of "removable" media accessing only first partition, so you will need to integrate cfadisk, dummydisk or diskmod).

Maybe you have *something* in that image that uses another more direct method of addressing that partition.

I would try making as base a new image of the "universal XP" by Wimb (and conversely also a 7 one for the testing):

http://reboot.pro/to...-and-windows-7/

 

About NT6, you don't really *need*  a (visible) BOOTMGR and BCD, you can well use the "fake floppy" (and OFS) method I put together for BIOS on GPT, it will work as well for BIOS on MBR:

http://reboot.pro/to...e-7#entry192974

 

As a matter of fact, I would appreciate if you could test the OFS approach here:

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

 

More generally - you could use the UMBR code to actually boot grub4dos placed *anywhere* and leave the .vhd as first partition.

 

 

@zoso

It is "as real" as any other partition.

No partition is "real", all partitions are just extents mapped as partitions in the MBR.

If they are mapped there, they "exist" and are "real", if they don't for all any OS can see they don't exist.

The (possible) issue here is that the mapped extent is comprised in the range belonging to another partition entry and this may cause a problem.

 

:duff:

Wonko



#16 steve6375

steve6375

    Platinum Member

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

Posted 16 June 2017 - 12:33 PM

The FullXPVHD.vhd file was prepared using http://www.rmprepusb...rials/110XPToGo

I did nothing to the image(apart from twiddle the boot.ini).

I was testing in VBox so the USB drive is seen as a rd/wr IDE HDD.

Not sure about drive letters.

When it boots as 3rd partition I get a pale blue desktop, it seems to do nothing for ages (5 mins) and then I get a My Computer desktop icon and a usable desktop (but no Bliss wallpaper and some taskbar/systray things are missing). system drive is D:

If I boot is as 1st partition - all is good (Bliss wallpaper, straight to Desktop) - system drive is C:   (same as using .vhdboot file extension in E2B).

 

I don't think this method is going to be useful for XP.

I will try with Win10 sometime...



#17 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 16 June 2017 - 01:56 PM

The FullXPVHD.vhd file was prepared using http://www.rmprepusb...rials/110XPToGo

I did nothing to the image(apart from twiddle the boot.ini).

I was testing in VBox so the USB drive is seen as a rd/wr IDE HDD.

Not sure about drive letters.

When it boots as 3rd partition I get a pale blue desktop, it seems to do nothing for ages (5 mins) and then I get a My Computer desktop icon and a usable desktop (but no Bliss wallpaper and some taskbar/systray things are missing). system drive is D:

If I boot is as 1st partition - all is good (Bliss wallpaper, straight to Desktop) - system drive is C:   (same as using .vhdboot file extension in E2B).

 

I don't think this method is going to be useful for XP.

I will try with Win10 sometime...

If the DosDevices keys are not (properly) populated, drive letter will be automatic, and first (primary) partition on first disk will get drive letter C:, and all other drive letters will be assigned by the built-in Windows mechanism.

 

Comeon :), these are not news, the matter has been talked about for years.

Actually more than ten years :w00t: , thanks to the Wayback Machine, a thread from April 2007:

https://web.archive....showtopic=19663

 

I don't think that  NT 6.x+ has changed anything when it comes to drive letter assignments.

 

Anyway, once you have booted (slowly/with the wrong drive letter) if you can run programs, you can use good ol' coa2 

http://www.pcmag.com...,1161199,00.asp

and - say - Registrar lite to change drive letter (to D: ) .

 

But, as said, you may want to change drive letter in the Registry, having C: point to the "right" (added, pointing to VHD) partition.

 

I don't understand why you are making it seem such a difficult thing, it has been done for years with a PE and offline (or mounted hive) registry editing. :dubbio: scripting it to be made to the "offline" registry while in grub4dos shouldn't be particularly problematic.

 

Open the Registry (or temporarily mount the System hive).

Export the hive (as .reg) HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices

Export again the hive (as. hiv) HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices

Open the .reg file in notepad (just to have a quick reference).

Open the .hiv file in *any* hex editor and search in it for "\DosDevices\C:" 

After it you will find 8 bytes, typically "01 00 F0 FF FF FF " and after that the (USB stick) Disk signature, like (example) "C0 FF EE 00 " an right after it the "sectors before" of the partition, like "00 7E 00 00 00 00 00 00".

Now search for "\DosDevices\D:" 

After it you will find 8 bytes, typically "01 00 F0 FF FF FF " and after that the (USB stick) Disk signature, like (example) "C0 FF EE 00 " an right after it the "sectors before" of the second partition, like (say) "00 0A 20 01 00 00 00 00".

Now search for the strings found, the first, "C0 FF EE 00 00 7E 00 00 00 00 00 00", you will find one item, a few lines below, just after a GUID *like* " \??\Volume{b0b284c4-8a33-11dd-8781-806d6172696f}".

Same goes for the string found for drive letter D:.

Now can you replace these strings inverting them with cat --hex --replace from gru4dos?

As a matter of fact you only need to invert the offset part, since the disk signature will be the same since it is the same disk.

 

This won't work if the device is seen as "removable" (hence the *need* of using a filter driver when the stick will be again a USB stick, outside the VM).

 

Alternatively what you may want to try could be to assign "invalid" partition ID's to the other partitions (not entirely unlike what you do with your ID 21 small last cylinder partition).

Grib4dos won't have any problem with a "wrong" partition ID, whilst the Windows disk manager will probably ignore (just like it does for ID 0x00) a partition ID *like* 27 (surely Windows NT6.x won't assign to it a drive letter) but I would try also the hidden types like 17 1b, etc. :unsure:

 

:duff:

Wonko



#18 steve6375

steve6375

    Platinum Member

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

Posted 16 June 2017 - 10:40 PM

Well, I thought I tried using hidden partitions but I just tested it again.

Hiding ptn #1 and #2 does seem to work and it boots to a nice Bliss desktop quickly

title XP VHD BOOT - PTN1 and PTN2 = type 0
# use raw disk image as ptn #2 and set as extended ptn
partnew (hd0,2) 0x0F /FullXPVHD.vhd
# set logical ptn as primary ptn
partnew (hd0,2) 0x07 (hd0,4)+1
root (hd0,2)
echo
# if XP, adjust boot partition - this modifies the VHD file!
cat --locate=tition( --replace=tition(3) /boot.ini
cat /boot.ini
echo
hide (hd0,0)
hide (hd0,1)
chainloader /ntldr || chainloader /bootmgr
boot

However, there are some very odd side affects.

 

First, there is a Drive A: in My computer with a label of 'GIF' which contains an E2B folder which contains some .bmp files

This folder is actually a file at \_ISO\Newton.ima which is a floppy image (vol label = GIF) and contains an E2B folder and the .bmp files in that E2B folder. Also, I can modify the contents in XP, but when I exit XP and look at the .ima file - the contents are not changed (which implies the .ima file has been mounted as a ram drive - floppy A is winvblock in Device Manager).

VHDCaptureDrives.JPG VHDCaptureDriveMgmt.JPG

Secondly, the diskmgmt.msc map is rather confused but I guess that is to be expected!



#19 Zoso

Zoso

    Silver Member

  • Advanced user
  • 640 posts
  •  
    Isle of Man

Posted 17 June 2017 - 02:12 AM

cool! are you only booting it through VMUSB? wonder how it would act if you used usboot on it then booted it without using VMUSB? maybe even add EWF into the mix..

I still use XP often and have still not been able to get W7+ to be as universal and autoload all driverpacks on foreign hardware.

Its good to see youre still experimenting with good ole XP.

#20 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 17 June 2017 - 09:13 AM

Good. :)

 

The disk management map is all in all correct (it cannot understand that you have a partition inside the extents of another partition), what did you use for first partition, 27 or 17 (or what)?

Diskpart is also correct, evidently it gives priority to the partition ID over analyzing the filesystem, whilst disk manager checks it.

 

You most probably can assign a drive letter explicitly to the first partition or use a mountpoint.

 

What does mountvol show?

 

The "A:" drive is clearly due to some *queer* setting (or misconfiguration/side effect) of Winvblock (which you can remove/uninstall from the VHD, actually the whole point of the exercise should be to boot the VHD without using it.

 

Most probably, Winvblock cannot find the intended file and it searches desperately to find *something* to mount.

 

As hinted before, there is no real need to make the partition a primary one, XP (like NT and 2K) is designed to run from a logical volume inside extended and since the partnew command (automatically and silently) corrects the "sectors before" in the bootsector, you won't have any issues in also booting it from logical inside extended.

 

The risk (has to be checked) is that unless you set the dosdevices key in the Registry, the XP will try and assign the C: drive letter to the first primary partition it finds on another disk (if there is more than one disk.

 

For the sake of testing, try deleting or renaming the BOOT.INI from inside the VHD ...

 

:duff:

Wonko



#21 steve6375

steve6375

    Platinum Member

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

Posted 17 June 2017 - 09:35 AM

The grub4dos hide command sets bit 0x10, so the partitions become type 0x17 and 0x31

I tried other values but they all gave the same results.

If I omit the second partnew command for (hd0,2) and set the root to (hd0,4) then it does boot correctly as drive C: from (hd0,4) even when another HDD exists with primary partitions.

However, this may vary depending upon what is in the users VHD.

If I disabled the WinVBlock driver - the drive A: goes away.

The only option I get from diskmgmt.msc for the 119GB E2B partition is to delete it! Diskpart does not list it as a volume, only a partition of 'unknown' type. I cannot assign a drive letter to it.



#22 steve6375

steve6375

    Platinum Member

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

Posted 17 June 2017 - 09:48 AM

Actually, I did some more testing because things that were not working before are now working -  and booting as (hd0,4) as root does NOT boot from a fresh VHD!

Once you boot using (hd0,2) as root you can then boot as (hd0,4) as root - but you cannot boot a 'new' VHD as (hd0,4).



#23 steve6375

steve6375

    Platinum Member

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

Posted 17 June 2017 - 10:13 AM

Yep - confirmed!
You have to boot the first time using primary ptn (hd0,2) and ptn1 and ptn2 must be hidden.
However, after that, you can unhide the USB ptn 1 & 2 and boot from (hd0,4) !!! Then you can also access the USB drive contents.
if you boot as (hd0,2) with the USB partitions unhidden, it will then always boot as D: and not C:
 

title XP VHD BOOT AS PARTITION
# use raw disk image as ptn #2 and set as extended ptn
set VHD=/FullXPVHD.vhd
partnew (hd0,2) 0x0F %VHD%
# set logical ptn as primary ptn
partnew (hd0,2) 0x07 (hd0,4)+1
root (hd0,2)
# if XP, adjust boot partition - this modifies the VHD file!
cat --locate=tition( --replace=tition(3) /boot.ini
hide (hd0,0)
hide (hd0,1)
set ask=Y
set /p:3 ask=Is this the first time you have booted from this VHD? ([Y]/N) :
if /i "%ask%"=="N" unhide (hd0,0) ;; if /i "%ask%"=="N" unhide (hd0,1)
chainloader /ntldr || chainloader /bootmgr
boot


#24 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 17 June 2017 - 12:01 PM

Sure, because the first time you boot it the "automatic" mechanism assigns the drive letter C: to first "non-hidden" primary partition  on first disk (which  is the VHD on (hd0,2), then writes this assignment in the DosDevices key on the Registry.

 

At next boot the partition data is the same (disk signature+offset) even if it is now a logical volume inside extended.

 

On a "first boot", the logical volume inside extended cannot boot as C:, possibly because it expects a primary partition. 

 

Maybe some of the "queer" things XP can do sometimes  over-ride the settings in dosDevices for C: if a primary is found (when there is a primary partition "before" the logical volume inside extended).

 

Can you confirm this? :dubbio: (normally once a drive letter is set appropriately in DosDevices is made "sticky").

 

About drive letter assignments, I'll try again:

What does the MOUNTVOL command show?

(when the first partition is 0x17 or - try it - 0x27[*])

 

And now - for no apparent reason - let's throw IMDISK on the table :w00t:

http://reboot.pro/to...image/?p=192170

you can always mount a physical extent (like the first hidden partition) with IMDISK ...

 

And - since you are into experimenting - what happens if you force (via a flag of some kind) first boot into recovery console?

Would it be enough to populate the DosDevices key? :unsure:

 

:duff:

Wonko

 

[*] 0x27 surely works in NT 6.00 and later






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users