Matt Wrock has done a lot of work on this for Windows.
https://github.com/mwrock/packer-templates He's got some great Powershell
scripts he runs to help reduce the size of his Windows images. I haven't
tried these specifically using the amazon-ebs builder but the idea is the
same. Specifically he's got a provisioner script he runs that removes a
bunch of features, cleans out logs and caches, and zeroes out the rest of
the empty disk
https://github.com/mwrock/packer-templates/blob/master/scripts/provision.ps1


On Mon, Sep 3, 2018 at 2:26 PM Rickard von Essen <
[email protected]> wrote:

> Hi,
>
> I don't know much about Windows but the way I would do it with a unix
> system is:
>
> 1) Use launch_device_mappings to attach an additional device
> 2) Mount it temporarly at say /mnt/tmp
> 3) Ensure that all clutter ends up on it
> 4) Unmount it
> 5) Use ami_device_mappings with no_device: true to not include the
> additional device in the final AMI
>
> I haven't tried this, but I'm pretty confident that it should work. I
> guess the same procedure should be possible for Windows.
>
> On Mon, 3 Sep 2018 at 17:48, sfoster <[email protected]> wrote:
>
>> Hello,
>>
>> I'm working on a windows vm build and want to move to the amazon-ebs
>> builder (currently I use a different builder with the amazon-import
>> post-processor). I'm having trouble achieving a reasonable ami size. The
>> provisioning is quite heavy, and leaves many gigs of cached files,
>> installers and logs. I use launch_device_block_mappings to give myself
>> enough disk overhead to carry out the provisioning but I can't figure out
>> how to shrink the size of the volume to fit once I've cleaned up all of the
>> clutter. From what I can tell, there is a manual way of doing this but it's
>> a bit involved.
>>
>> Does the amazon-ebs builder have a way to shrink the volume at the end of
>> the build?
>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/packer-tool/dd269a9f-b5c5-45e3-9974-34955035b2c7%40googlegroups.com
>> <https://groups.google.com/d/msgid/packer-tool/dd269a9f-b5c5-45e3-9974-34955035b2c7%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CALz9Rt-5u%3D0Ko4PUDFqxzdZqwQ0c4YXmhLVr_Mtac4uU4NO5bg%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt-5u%3D0Ko4PUDFqxzdZqwQ0c4YXmhLVr_Mtac4uU4NO5bg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
JP Toto   |   [email protected]   |   http://jptoto.jp   |   @jptoto
<http://twitter.com/jptoto>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAAYNrX-2a0eUCWSZ5%2B%2BHeJBdWcoo6CKVCj%3Dmw_bPad-q_2gaHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to