cloudbase / windows-imaging-tools

Tools to automate the creation of a Windows image for OpenStack, supporting KVM, Hyper-V, ESXi and more.
Apache License 2.0
684 stars 229 forks source link

About the partition #176

Closed shrekmaxi closed 6 years ago

shrekmaxi commented 7 years ago

Hi, there, I have a simple question: how to make the images use partial disk space (like 100G for C:)instead of using the entire disk as C:\ during the deployment process? Thanks

ader1990 commented 7 years ago

Hello,

You need to manually edit the Unattend.xml file before starting the vm (you are required in this case to use New-WindowsCloudImage, that will create only the VHD, without spawning the VM). Then you need to create/start the VM with that backing VHD file and wait for it to stop.

You can also leverage the new feature custom_scripts where you can define using diskpart.exe the required partitioning. More details here or in the config.ini generated file: https://github.com/cloudbase/windows-openstack-imaging-tools/blob/experimental/Config.psm1#L68

Thank you, Adrian Vladu

shrekmaxi commented 7 years ago

Thanks for your reply, Maybe I was not so precise about my question, what I really want is using the openstack-windows-images for deployment on MAAS. But there is only one problem: After the openstack-windows-images have been deployed into nodes(physical servers), I found the servers only have one partion, and the partitions all are Maximum size of entire disks. just like this:(each server has one 1T H.D.D) openstack-windows-image-ds

So any chance the partition size of deployment can be modified?

Thanks

ader1990 commented 7 years ago

In this case, Cloudbase-Init has a plugin (LocalScripts) that executes scripts located at a configurable path. You can put in such a script the partitioning scripts. More details: https://cloudbase-init.readthedocs.io/en/latest/plugins.html#scripts-execution-main

The LocalScriptsPlugin is executed by default.

Thank you, Adrian Vladu

shrekmaxi commented 6 years ago

@ader1990 Thanks so much for the suggestion, I am not so sure about the procedure. Do you mean insert the local scripts into the VM during the "New-WindowsOnlineImage" process or install Cloudbase-init on the machine which generates openstack-windows-image ?