Jump to content











Photo
- - - - -

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

aws boot

  • Please log in to reply
6 replies to this topic

#1 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 130 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
  • 2735 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
  • 130 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
  • 130 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
  • 2735 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
  • 2735 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


#7 VeeDub

VeeDub

    Frequent Member

  • Advanced user
  • 130 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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users