Hi Ian, Also passing on thanks for taking the time to write this up - there’s a chance I’ll need to do this in a few weeks!
Adam > On 10 Sep 2016, at 05:46, Ian Collins <[email protected]> wrote: > > On 09/ 9/16 11:32 PM, Jason Schmidt wrote: >> Hi Ian, >> >> I would be interested in seeing how you got around this, if you don't >> mind sharing. > > Sure.. > > The process was somewhat convoluted and some of steps I took may have been > unnecessary but I was working stuff out and leaning windows tools as I went > along. > > First off I'm pretty sure this will only work with Hyper-V machines with a > fixed drive, which in my case gave me a 500GB file to work with... > > My first step was to convert the vhdx file to a raw with virtual box. I did > this to get a format I know works with qemu-img on SmartOS. If I had to do > this again, I'd see if this step can be skipped. > > VBoxManage clonehd fixed-bld-01.vhdx --format RAW fixed-bld-01.raw > > On the SmartOS host I created a KVM with two 501GB IDE drives and wrote the > image over the first drive: > > qemu-img convert -f raw -O host_device fixed-bld-01.raw > /dev/zvol/rdsk/zones/<uuid>-disk0 > > The extra GB on the drive prevents qemu-img convert complaining about lack of > space on the volume. > > The next phase creates a clean copy of the the drive without a bootloader > using windows imaging tools to image the drive and restore it. > > * boot the VM using a windows PE ISO (created using the windows ADK tools) > with a couple of extra utilities (diskpart and imagex) copied from a running > windows system. > > * use diskpart to create a partition on the second drive. > use imagex to create a backup image of the first drive on the second. > > * use diskpart to wipe and create a clean partition on the original drive. > use imagex to restore the backup image of the first drive from the second. > > I then halted the VM, deleted the second drive and rebooted from a server > 2012 ISO and followed the repair computer steps to get a command shell. From > there I setup the bootloader: > > bootrec /fixmbr > bootsect /nt60 all /force > bootrec /rebuildbcd > bcdboot c:\windows > > At this point I had a bootable system :) > > After that, add a small virtio dive and a virtio NIC, boot the machine with a > virtio driver ISO attached and install the virtio drivers. Shutdown the VM, > update the first drive to virtio, restart and you will have a system disk > ready for imaging. > > Phew, did I say the process was convoluted? > > -- > Ian. > ------------------------------------------- smartos-discuss Archives: https://www.listbox.com/member/archive/184463/=now RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00 Modify Your Subscription: https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb Powered by Listbox: http://www.listbox.com
