Shrink zvol of VM

zierbeek

Explorer
Joined
Apr 4, 2021
Messages
54
You were just toooo fast Patrick, honestly, very grateful for your help to make it clear.

the three commands indeed show the right amounts and do take up less space. I'm just wondering how the filesystem in the CLI of Ubuntu could be bigger than zfs is reporting

Code:
root@truenas[~]# zfs get refreservation jail/mediavm-0b6la
NAME                PROPERTY        VALUE      SOURCE
jail/mediavm-0b6la  refreservation  none       local
root@truenas[~]# zfs get refer jail/mediavm-0b6la
NAME                PROPERTY    VALUE     SOURCE
jail/mediavm-0b6la  referenced  21.3G     -
root@truenas[~]# zfs get used jail/mediavm-0b6la
NAME                PROPERTY  VALUE  SOURCE
jail/mediavm-0b6la  used      28.5G  -
root@truenas[~]# zpool list
NAME        SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
boot-pool  29.5G  3.64G  25.9G        -        1G     7%    12%  1.00x    ONLINE  -
jail        176G  57.5G   119G        -         -    13%    32%  1.00x    ONLINE  /mnt
media      1.81T  1.29T   534G        -         -    21%    71%  1.00x    ONLINE  /mnt
tank1      5.45T   211G  5.25T        -         -     0%     3%  1.00x    ONLINE  /mnt
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I'm just wondering how the filesystem in the CLI of Ubuntu could be bigger than zfs is reporting
You can create a zvol of size 100G, clear the refreservation, and it will only take up a couple of megabytes. When you install Ubuntu, it will see a disk of size 100G, but only write some partition information and then in the course of the installation some 10G to 20G to the disk. ZFS will only report those blocks as used that have actively been written to. That's what "sparse/thin" means. If you fill the disk to the brim inside the VM, it will occupy all of the 100G on the outside, too.
 

zierbeek

Explorer
Joined
Apr 4, 2021
Messages
54
You can create a zvol of size 100G, clear the refreservation, and it will only take up a couple of megabytes. When you install Ubuntu, it will see a disk of size 100G, but only write some partition information and then in the course of the installation some 10G to 20G to the disk. ZFS will only report those blocks as used that have actively been written to. That's what "sparse/thin" means. If you fill the disk to the brim inside the VM, it will occupy all of the 100G on the outside, too.
Yeah, thanks, that is indeed what I understood. I just do not understand how zfs reports that 23G is used and within the vm, it reports that 73% of 43G is used (which should be around 31G)
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I just do not understand how zfs reports that 23G is used and within the vm, it reports that 73% of 43G is used (which should be around 31G)
Compression :wink:
 
Top