[SOLVED] Resizing guest disk

Walery

Member
Feb 11, 2021
67
1
13
42
I have a virtual machine running Windows server 2008 r2 (disk size 600 Gb) I want to reduce the size of the disk by 42 Gb.
How can i do this?
The virtual machine disk in .raw format is located in the ZFS storage
 

Attachments

  • disk1.jpg
    disk1.jpg
    62.6 KB · Views: 7
Making a disk smaller is always risky. Make sure to have a backup of the VM before you make the next steps.

Since this disk is located on a ZFS pool, what is the output of zfs get all <pool>/<path>/<to vm disk>?

In general, you want to change the volsize parameter of the zvol to the new size. Also check if the reservation property is set to some value and if it changed automatically as well.
zfs set volsize=<size>G <pool>/<vm disk>
 
Making a disk smaller is always risky. Make sure to have a backup of the VM before you make the next steps.

Since this disk is located on a ZFS pool, what is the output of zfs get all <pool>/<path>/<to vm disk>?

In general, you want to change the volsize parameter of the zvol to the new size. Also check if the reservation property is set to some value and if it changed automatically as well.
zfs set volsize=<size>G <pool>/<vm disk>
I didn't understand the command
zfs get all <pool> / <path> / <to vm disk>

my pool is store1
vm is 100
But what is <path>? is it a directory? my drive is not in a directory.

zfs get all store1 / <path> / to 100 disk ?
 
Most likely it will be <pool>/<vm disk> but ZFS can have nested datasets which would then lead to a deeper hierarchy.
 
Most likely it will be <pool>/<vm disk> but ZFS can have nested datasets which would then lead to a deeper hierarchy.
zfs get all
store1/vm-100-disk-0 type volume -
store1/vm-100-disk-0 creation Mon Mar 1 13:46 2021 -
store1/vm-100-disk-0 used 891G -
store1/vm-100-disk-0 available 1.73T -
store1/vm-100-disk-0 referenced 376G -
store1/vm-100-disk-0 compressratio 1.41x -
store1/vm-100-disk-0 reservation none default
store1/vm-100-disk-0 volsize 600G local
store1/vm-100-disk-0 volblocksize 8K default
store1/vm-100-disk-0 checksum on default
store1/vm-100-disk-0 compression on inherited from store1
store1/vm-100-disk-0 readonly off default
store1/vm-100-disk-0 createtxg 80378 -
store1/vm-100-disk-0 copies 1 default
store1/vm-100-disk-0 refreservation 891G local
store1/vm-100-disk-0 guid 2778877911890891769 -
store1/vm-100-disk-0 primarycache all default
store1/vm-100-disk-0 secondarycache all default
store1/vm-100-disk-0 usedbysnapshots 0B -
store1/vm-100-disk-0 usedbydataset 376G -
store1/vm-100-disk-0 usedbychildren 0B -
store1/vm-100-disk-0 usedbyrefreservation 516G -
store1/vm-100-disk-0 logbias latency default
store1/vm-100-disk-0 objsetid 4195 -
store1/vm-100-disk-0 dedup off default
store1/vm-100-disk-0 mlslabel none default
store1/vm-100-disk-0 sync standard default
store1/vm-100-disk-0 refcompressratio 1.41x -
store1/vm-100-disk-0 written 376G -
store1/vm-100-disk-0 logicalused 365G -
store1/vm-100-disk-0 logicalreferenced 365G -
store1/vm-100-disk-0 volmode default default
store1/vm-100-disk-0 snapshot_limit none default
store1/vm-100-disk-0 snapshot_count none default
store1/vm-100-disk-0 snapdev hidden default
store1/vm-100-disk-0 context none default
store1/vm-100-disk-0 fscontext none default
store1/vm-100-disk-0 defcontext none default
store1/vm-100-disk-0 rootcontext none default
store1/vm-100-disk-0 redundant_metadata all default
store1/vm-100-disk-0 encryption off default
store1/vm-100-disk-0 keylocation none default
store1/vm-100-disk-0 keyformat none default
store1/vm-100-disk-0 pbkdf2iters 0 default
 
You will have to set the volsize propery to the newer, smaller value.

zfs set volsize=<size>G store1/vm-100-disk-0

I recommend set it 1 or 2 GB larger just to avoid any accounting differences causing problems. If you then start the VM again, it should see the disk being smaller
 
  • Like
Reactions: Walery
You will have to set the volsize propery to the newer, smaller value.

zfs set volsize=<size>G store1/vm-100-disk-0

I recommend set it 1 or 2 GB larger just to avoid any accounting differences causing problems. If you then start the VM again, it should see the disk being smaller
Fine! Everything works. Thank.
 
  • Like
Reactions: aaron

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!