Resize imported ( from esxi ) disks, possible ?

Pigi_102

Member
May 24, 2024
43
6
13
Hello all,
I've completed the import of 3 VM from an esxi environment and have the following problem.
Disk size on configuration was 320G but they where in thin mode, so the real occupation on disks was a lot less ( more or less 45G )
A part from using some sort of Clonezilla or system rescue cd, is there a way to "shrink" those disks to get them back to a similar thin mode ?
Or eventually is there a procedure to get the same result eventually using Clonezilla ( or similar ) ?
I'm on a local zfs storage, BTW

Thanks in advance

Pigi_102
 
Have you enabled thin ZFS? If so, please post the ouput in CODE tags of e.g.

Code:
zfs list -o name,volsize,volblocksize,used,lused,refer,lrefer,compressratio

Have you enabled discard for
 
  • Like
Reactions: Pigi_102
Code:
root@pve:~# zfs list -o name,volsize,volblocksize,used,lused,refer,lrefer,compressratio
NAME                    VOLSIZE  VOLBLOCK   USED  LUSED  REFER  LREFER  RATIO
localzfs                      -         -  2.42T   671G    96K     42K  1.53x
localzfs/localstorage         -         -   104K    43K   104K     43K  1.00x
localzfs/vm-100-disk-0      10G       16K  10.2G  4.02G  2.25G   4.02G  1.79x
localzfs/vm-100-disk-1     300G       16K   305G    28K    56K     28K  1.00x
localzfs/vm-101-disk-0      32G       16K  32.5G  4.69G  2.98G   4.69G  1.57x
localzfs/vm-102-disk-0      90G       16K  91.4G  26.5G  19.4G   26.5G  1.36x
localzfs/vm-102-disk-1       1M       16K     3M   560K    72K    560K  14.00x
localzfs/vm-103-disk-0     100G       16K   102G  54.4G  37.6G   54.4G  1.45x
localzfs/vm-104-disk-0     320G       16K   325G   159G  97.6G    159G  1.64x
localzfs/vm-105-disk-0    50.0G       16K  50.8G  15.3G  9.68G   15.3G  1.58x
localzfs/vm-106-disk-0      20G       16K  20.3G  19.6G  11.0G   19.6G  1.79x
localzfs/vm-106-disk-1      20G       16K  20.3G  2.91G  1.27G   2.91G  2.30x
localzfs/vm-107-disk-0      80G       16K  81.3G  32.7G  23.9G   32.7G  1.37x
localzfs/vm-108-disk-0      60G       16K  60.9G  25.0G  13.2G   25.0G  1.89x
localzfs/vm-110-disk-0       1M       16K     3M   560K    72K    560K  14.00x
localzfs/vm-110-disk-1     200G       16K   203G  54.6G  38.4G   54.6G  1.42x
localzfs/vm-110-disk-2       1M       16K     3M   560K   116K    560K  6.66x
localzfs/vm-111-disk-0     320G       16K   325G   127G  93.6G    127G  1.35x
localzfs/vm-112-disk-0     320G       16K   325G  44.6G  30.9G   44.6G  1.44x
localzfs/vm-113-disk-0     320G       16K   325G   101G  55.6G    101G  1.81x

I didn't have enabled discard. Where I was supposed to enable it to ?
Sorry but I'm really newbie on this world.

Pigi_102
 
Ok, I've found the "enable thin" in zfs configuration and have changed to yes.
Do I need to do something to allow zfs to do their magic ?
Do the "discard" has to be enabled on disks, now ?


Thx

Pigi_102
 
ZFS already stores the data thin/spare but you need to remove the refreservation of the virtual disks to not have it reserve all space anyway:

EDIT: https://pve.proxmox.com/pve-docs/pve-admin-guide.html#sysadmin_zfs_raid_size_space_usage_redundancy
 
Last edited:
  • Like
Reactions: Pigi_102
I've done the steps indicated and it seems I really got back lot of unused space.
Thanks very much.

Now I only need to figure why some vm disks have the chance to change the ssd emulation and some don't :)

Back on manuals !

Pigi
 
I've done the steps indicated and it seems I really got back lot of unused space.
Be sure not to over-commit and run into VMs running into I/O errors because the host has no more disk space.
Now I only need to figure why some vm disks have the chance to change the ssd emulation and some don't
I can't tell from just your information but the manual states: Note that SSD emulation is not supported on VirtIO Block drives. Personally, I prefer VirtIO SCSI (Single) instead.
 
Yeah, that's exactly what I found.Detached and reattached the disks as scsi instead of block and voila ! SSD is back again.
Thanks very much !