Shrink

Zer0

New Member
Sep 30, 2018
6
0
1
25
Hi, I'm looking to get the proper technique for shrinking a Windows VM. I'm trying to create a template of a Windows 2012 VPS with RAW file format. I understand that I need to first shrink the VPS internally (proper command for doing so would be appreciated) and then shrink it from the host node. Is there any documentation on this?
 
With RAW (as file), this is not possible. If you have a ZVOL or (thin)LVM, it is possible. Please elaborate what you currently have.
I'm not entirely sure which we have. Our node storage is local SSD which I believe is using just plain LVM. Do you mean if the VM is RAW format we will not be able to shrink the VM or create any sort of template from it?
 
Do you mean if the VM is RAW format we will not be able to shrink the VM or create any sort of template from it?

As I said, this depends on the storage. If you use LVM, then it is not a problem at all.

Please post
Code:
cat /etc/pve/storage.cfg
 
So I believe it is LVM.

Code:
# definition of storage for Proxmox VE.
# this is empty by default as there is no "one size fits all" configuration.
# this config can be managed manually, or via PVE web interface.
# please read https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_storage_pools before changingthis file

## storage for iso,vztmpl,backups
#dir: local
#       path /var/lib/vz
#       content iso,vztmpl,backup

## default image store on LVM based installation
#lvm: pve
#       vgname pve
#       content rootdir,images

Going back to my original question, how would I shrink the template with this file system. Is there any benefit to having the template shrunken when it's already a fairly small size?
 
Is there any benefit to having the template shrunken when it's already a fairly small size?

On one hand, fast backup times and faster cloning ,and on the other hand, you always have to resize the disk after cloning.

If you zero out the free space, your image needs less space on a sparse storage backend as thin LVM and ZFS.
 
Either way, the disk will need to be resized if we have RAW format each time a new VPS is created from the template, correct?

What would be the procedure for shrinking the VM to create a small template? I know it has to be done inside the VM first but I can't find proper documentation and don't want to mess it up. Thanks.
 
Either way, the disk will need to be resized if we have RAW format each time a new VPS is created from the template, correct?

If you want it to grow after cloning, sure.

What would be the procedure for shrinking the VM to create a small template? I know it has to be done inside the VM first but I can't find proper documentation and don't want to mess it up. Thanks.

There is no documentation because this can go terribly wrong. For Windows, just read about it in some Windows forums, this is not PVE related.

I also recommend not to convert the VM into a PVE template, because you want to update the machines, this is easier if the machine is not a template, because templates cannot be changed. You also need some space for the VM, e.g. we have Windows 10 VMs with 40 GB of diskspace due to the vast storage requirements for the internal windows 10 release upgrades, 32 GB was not enough. Same goes for RAM. The update process needs 2 GB of RAM, while the VM runs smooth at 768 MB.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!