-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Hyper-V] Use differential disks and Inline disk creation to improve build time (a lot) and to reduce disk usage(a lot) #5631
Conversation
@vijayinvites I merged your other PR already but do you think you could add docs for the new differencing_disk option? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks really good; the only thing that's missing is docs. I'd also like to leave this open in a branch for a while to give users of hyper-v a chance to find any bugs before we merge.
@SwampDragons I have added the missing docs. Please check and let me know if anything else is required. |
@pvandervelde @abhipallav @Ajmal-S Can you guys please test this PR and report any feedback/issues? |
Would love to get this out for the 1.1.3 milestone, but would also love to hear some feedback from people who will be using the feature. |
@SwampDragons what't the due date for 1.1.3 milestone? @pvandervelde @abhipallav @Ajmal-S Can you guys please test this and report any issues/feedback? |
We were gonna try to release today. |
@SwampDragons @vijayinvites I will test it today and then post my feedback. |
42aae5b
to
5346583
Compare
I just came across this today - haven't been following the repos closely enough so I have a few questions and comments here:
It sounds like a lot of this is work towards a hyperv-vhd builder. How would this affect hyperv-iso? Normally I see a new (empty) VHDX created in the
|
@PatrickLang
|
Is there a branch where you're working on a hyperv-vhd builder? That's the main thing I'm missing here. Prior to Packer, I was using |
Also re: the diff disks - when you package up a box is the plan to pack up each VHD in the chain? |
No I do not have a public github branch or anything that I can share it with you. We can use the Merge-VHD (powershell) cmdlet that lets you merge up all the differencing disks and create one cumulative VHD. We don't need to do this. We can create a VM from the any differencing disk and the VM works just as well. Try it out, its really cool :) |
Ah, I see. I missed this in the release notes: I'll give it a try and share a sample. |
I am using this new feature for a while now. I works fine for me and saves me a lot of space. Thanks @vijayinvites |
I have been using the packer executable created from this pull request from quiet some time to create VM images and it does saves me a whole lot of time and space. |
Thanks @abhipallav and @SumitRoy1 @SwampDragons , Can this be merged soon? |
This is set for the 1.2.0 milestone, so we won't be merging until after the 1.1.4 release. |
I just came by this a week ago, and have used this feature for several days without any issues. It works great and really speed things up! I had some challenges configuring the use of differencing_disk the first time. I think an example in the docs would be really helpful for starters like me. Here is the builder configuration I ended up using: |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
There are some pain points to use VHD to VHD builder. This PR tries to resolve them. This PR uses #5458
Time to create a VM before a new provisioner starts and the extra space needed.
Current Behavior:
The parent vhdx is copied to a %temp% location and a VM will be created from this and the same disk is provisioned(modified) The overhead is copying the VM and the extra disk space that is required. If we are using a 50 GB vhdx as a base image, we are copying the 50GB to the disk again before we start provisioning. It takes a while and uses extra 50GB space. As most people use SSD(as their OS drive for faster accessing), most of us cant afford to allocate this much disk space.
Proposed solution:
Using differential disk we do not need to copy the base image to the %temp% location. Instead we create a differential disk whose parent is the base image (note that the base image is not modified). VM creation is instant. We start provisioning instantly. All the modifications are done only in the new disk which will be linked to the parent disk.
VM Export
Current Behavior:
Once we finish provisioning, the VM will be exported. Packer makes a new copy of the vhdx that is provisioned in the %temp%\export folder. This again involves copying the entire vhdx file to %temp% location. This exported VM again will be copied to the <output_directory> that we specify. e.g. The size of provisioned VHD is 90 GB. This 90GB is copied twice. Once: To create an exported VM and Again: to copy the exported VM to the output directory. So we need 180 GB of free space in our SSD for this to happen.
Proposed solution:
We create inline differential disk and skip VM export. The new differential disk will directly be created in the <output_directory> and will be provisioned inline. So we can skip copying the provisioned disk again and again. As we deal with only vhdx files and we do not need an exported VM, we can skip exporting VM.
This saves lot of time and hard disk space.
I would like people to try this out and see how this speeds up everything. Also feedback/suggestions are always welcome.
You need to use the following two properties to use differential disks and create inline disks.