Thin Provision

lweidig

Active Member
Oct 20, 2011
104
2
38
Sheboygan, WI
Somehow one of my storages does not have thin provision on it (ZFS storage if that matters) and I migrated a number of machines to it. Is there a way to enable thin provisioning (yes I know about the check box) AND then have the images shrunk to be thinly provisioned. Of course would prefer if this can be done with the images running. Thanks!
 
1. set the virtual disk type to SCSI
2. set the SCSI controller type (in "Options") to VIRTIO-SCSI

Start the VM and do a "fstrim /" or the filesystems you want to trim. For Windows or other OSes you need to find the equivalent.
 
1) Choose SCSI emulation for drives
2) Choose VIRTIO for scsi controller type (options tab)
3) Assuming Linux OS in guest: run fstrim <PATH to disk mount> (If disk is mounted on root (/) then fstrim /
 
Start the VM and do a "fstrim /" or the filesystems you want to trim. For Windows or other OSes you need to find the equivalent.

Conveniently, for any OS (including Linux) simply filling the disk with 0 bytes does the trick, as the underlying ZFS will compress those blocks down to nothing. Here's what I do on FreeBSD:

Code:
cd /
dd if=/dev/zero of=filler bs=4k
rm filler

Repeat for each disk partition. Let the dd command run until it gives a disk full error.
 

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!