Jump to content











Photo
- - - - -

Convert WinPE ISO to disk image - so can use in AWS

aws boot

  • Please log in to reply
9 replies to this topic

#1 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 140 posts
  •  
    Australia

Posted 08 May 2019 - 01:11 PM

Hello,

 

I'm investigating the possibility of using AWS for 'disaster recovery' restores of Windows images.

 

To be able to do this, I need to be able to boot the backup system recovery environment, which is a 'custom' WinPE ISO in an AWS VM 

 

The problem with that last statement, is that if you want to import a custom VM into AWS; you can't use an ISO image as the source  :(

 

The source image has to be a 'disk' (e.g. a VMDK from VMware) see here (2nd last response for a concise summary of the requirements).

 

So I need to convert the ISO image into a disk image - and the disk image needs to be "vanilla" (i.e. no GRUB etc.) The image needs to look like a 'standard' Windows disk image (albeit a WinPE disk image).

 

Not sure if I have posted this question in the right forum, if not, hope it can be moved.

 

Appreciate suggestions 

 

Thanks

 

VW



#2 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 08 May 2019 - 01:52 PM

Hi,

 

Iso, img, vmdk, etc are just containers and there are many / different ways to move "what sits" in one container to another container.

Thus doing so, you have to consider the source and target filesystem and boot loader.

If you dont care about these, then ever easier : open your iso in one of the many existing tools (7zip is one) and drag and drop (or "extract" if you prefer) from source to destination.

 

Does it have to be vmdk as destination? any other format possible like plain/raw/dd image format or vhd format?

 

Regards,

Erwan



#3 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 140 posts
  •  
    Australia

Posted 08 May 2019 - 02:07 PM

@Erwan,

 

I'm a newbie when it comes to building a custom AMI (AWS Machine Image). I've not even attempted it yet. I've looked at some YouTube videos and stuff I've found via Google to try and understand the process.

 

To be frank the info on the process seems limited and as a result there is probably going to be some "trial and error" on my part. I just want to try and minimise the amount of error.

 

So in answer to your question - I don't really know.

 

That link I posted indicates that not all vmdk images are equal (i.e. VMware works - VirtualBox may not). The Official AWS documentation specifically recommends using VMware to create the VMDK image. 

 

So my preference is to understand how I go about converting an ISO to a VMDK, and then try to do that within a VMware VM, as I think that is most likely to meet all the stated pre-req's as I understand them.

 

Having said that, the ISO image is around 700MB

 

So if there are some tools that read an ISO image and produce a VMDK and they're easy to use. Then I may as well try that, because if it doesn't take long to create the VMDK image - then if the AWS import fails - then not a lot of time & effort has been lost.

 

I'm after some direction, so I can try and make intelligent attempts.



#4 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 140 posts
  •  
    Australia

Posted 08 May 2019 - 02:11 PM

To clarify:

 

The AWS import process seems to be intended to import Windows or Linux VM's into AWS (i.e. VM's that have disk images - VMDK's)

 

So ideally I want to convert my ISO into a Windows disk image within a VMware Windows VM.

 

If I can get my ISO onto a 1GB Windows hard disk within a Windows VM - and it behaves the same as the ISO. Then I'm hopeful that the export/import process will work the same as for a "vanilla" Windows VM



#5 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 08 May 2019 - 02:11 PM

The link you posted seem to indicate VHD format as well.

I would suggest you confirm that first as VHD images are much easier to handle compare to VMDK.
By that I mean that there are tons of software/freeware/scripts out there to play (read & write) with VHD.
Actually you may even be able to move files from an ISO to a VHD with 7zip only.

Reading a vmdk is "easy" enough and you will find different tools on this forum.
Writing is less popular even if I am sure there are tools out there to convert to VMDK.

What I can think of :
-create a VHD big enough to contain the files found in my ISO
-mount that VHD
-format my virtual drive
-open my ISO with 7zip
-extract my ISO files to my virtual drive
-eventually (if needed) setup a bootloader in my virtual drive
-unmount my VHD
  • VeeDub likes this

#6 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 11 May 2019 - 02:09 PM

Just for fun (although there are plenty of other ways/tools).

 

Converting an iso to a vhd using vmount and 7z.

rem set input and output
set vhd=e:\test.vhd
set iso=C:\_QuickPE\x86\winre.iso
rem lets delete the output
del /q %vhd%
rem createfixedvhd - depending on the boot loader we could go for a dynamic vhd or compress it with lz4
vmount-win64 createfixedvhd %vhd% 512
rem attachvhd 
FOR /F "tokens=* USEBACKQ" %%F IN (`vmount-win64 attachvhd %vhd%`) DO (
SET drive=%%F
)
echo %drive%
rem createdisk - default is MBR
vmount-win64 createdisk %drive%
rem createpart - default is MBR
vmount-win64 createpart %drive%
rem refresh 
vmount-win64 refresh %drive%
rem \\.\PHYSICALDRIVEX -> HarddiskX
echo %drive:~17,1%
rem get drive letter
FOR /F "tokens=* USEBACKQ" %%F IN (`vmount-win64 devices Harddisk%drive:~17,1%`) DO (
SET letter=%%F
)
echo %letter%
rem format - no confirmation - live dangerous
format %letter% /q /fs:ntfs /y
rem extract iso to letter - but we could also have mounted our iso with vmount
7z.exe x -y -o%letter% %iso%
rem set bootloader
bootsect /nt60 %letter% /force /mbr
rem detach
vmount-win64 detach %drive%
rem we are ready to boot our vhd
rem we could use qemu like this qemu-system-i386 -L . -hda "e:\test.vhd" -m 512 -cpu Nehalem

  • Tokener and doberman like this

#7 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 140 posts
  •  
    Australia

Posted 12 May 2019 - 12:05 AM

Hi,

 

I was able to convert the ISO to a VHD, make it bootable and commence the import into EC2

 

Only for the import process to fail around 1/3 the way through, advising that WinPE is not a supported environment

 

Thanks to your earlier guide, I had a 'roadmap' to do the conversion and as a result didn't waste a lot of time reaching that point.

 

I've since moved on to a different approach.

 

Thanks for your help.

 

VW



#8 virgus

virgus

    Newbie

  • Members
  • 26 posts
  •  
    Italy

Posted 24 May 2020 - 01:27 AM

 

Just for fun (although there are plenty of other ways/tools).

 

Converting an iso to a vhd using vmount and 7z.

 

 

Dear Erwan, everything worked perfectly with the latest version of vmount!

I'm keeping "studying" ;-) and I also tried your sequence in this post successfully.

 

I used a ready made version of Win10XPE; the 64bit version from an italian website (turbolab.it/scarica/87) and I can boot the WinPE.vhd from Grub4Dos. This is great indeed ad it worked at the first try with the SVbus settings, both from RAM or from FILE.

 

Now I'm trying to set up a pure BCD boot and followed the BCDedit commands I use normally for VHDs, but the WinPE structure is much different and I'm a bit lost. I tried to follow the recommendations that I found here and here but without any success.

 

The original BCD entry of the Win10XPE is as follows:

identifier              {default}
device                  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
path                    \windows\system32\boot\winload.exe
description             Win10XPE x64
inherit                 {bootloadersettings}
osdevice                ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
systemroot              \windows
custom:250000c2         0
detecthal               Yes
winpe                   Yes
ems                     No

And I'm wondering how to make the boot process (either from ram or not) target the \windows\system32\boot\winload.exe inside the boot.wim that needs to be opened from inside the VHD file...

 

Did anybody here succeed in doing this ?

 

Cheers,

V.

 


Edited by virgus, 24 May 2020 - 01:28 AM.


#9 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 May 2020 - 08:01 AM

Virgus,

maybe you are confusing things. :dubbio:

 

The link you posted:
https://systemscente...0df1dc3f176.htm

 

is about a "flat" boot, if you prefer a boot from a volume where the boot.wim has been applied.

 

I am not sure about what you are after:

 

 

  And I'm wondering how to make the boot process (either from ram or not) target the \windows\system32\boot\winload.exe inside the boot.wim that needs to be opened from inside the VHD file...

 

 

That is what the BCD you posted is about, if I get it right. :dubbio:

 

And how is all this related to the topic of this thread (which is WinPe disk image to be used on AWS)?

 

:duff:

Wonko


  • virgus likes this

#10 virgus

virgus

    Newbie

  • Members
  • 26 posts
  •  
    Italy

Posted 24 May 2020 - 11:02 PM

God bless you Wonko! :clap:

 

Your feedback/question gave me all the answers :-)

I'm sorry if my questions have been off topic, I guess it was too late yesterday night and I had lost my clarity of mind.

 

Anyway I just applied Erwan's method with the boot.wim file instead of the iso file and the BCD native boot is OK

Now I have a bootable VHD working from BCD and I have to figure out how to boot it with Grub 4 Dos (the tests I just made with SVbus did not work, but I might have made some mistakes and I'll try again tomorrow as it's already too late).

 

Thanks again for your support,

Virgus






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users