[PVE-User] sparse and compression

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Dec 11 16:37:57 CET 2017


On Mon, Dec 11, 2017 at 03:47:56PM +0100, Andreas Herrmann wrote:
> Hi
> 
> On 11.12.2017 14:17, Fabian Grünbichler wrote:
> > On Mon, Dec 11, 2017 at 01:40:28PM +0100, Miguel González wrote:
> >>  Why a virtual disk shows as 60G when originally It was 36 Gb in raw format?
> >>
> >>  NAME                       USED  AVAIL  REFER  MOUNTPOINT
> >>  rpool/data/vm-102-disk-1  60.0G  51.3G  20.9G  -
> > 
> > wild guess - you are using raidz of some kind? ashift is set to 12 /
> > auto-detected?
> 
> No! 'zpool list' will show what is used on disk. zfs list is totally
> transparent to zpool layout. Have a look at 'zpool get all' for the ashift
> setting.

I know. in most cases when people are surprised by their zvols taking up
more space than expected, it is because they are using raidz and don't
know about the interaction between ashift=12, raidz and small
volblocksize.

> 
> Example for raidz1 (4x 960GB SSDs):
> root at foobar:~# zpool list
> NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
> zpool  3.41T   102G  3.31T         -     8%     2%  1.00x  ONLINE  -
> 
> root at foobar:~# zfs list
> NAME                             USED  AVAIL  REFER  MOUNTPOINT
> zpool                            237G  2.17T   140K  /zpool
> 
> zpool ALLOC is smaller than zfs USED in this example. Why? Try to unserstand
> the difference between 'referenced' and 'used'. My volumes aren't sparse but
> discard is used.

your output is pretty worthless, as "REFER" only refers to the pool
dataset, and not its children. I do know the difference between used and
referenced, which is not (directly) related to discard at all. discard
can obviously get your referenced value down ;)

see the following for an example where a 10G volume takes more than 10G
of space in 'zfs list' output:

$ zfs list testpool -r -o name,used,referenced,volsize
NAME            USED  REFER  VOLSIZE
testpool       14.3G   140K        -
testpool/test  14.3G  14.3G      10G

$ zpool list testpool
NAME       SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
testpool  39.8G  19.7G  20.1G         -     0%    49%  1.00x  ONLINE  -

the only difference between a sparse and non-sparse zvol is whether
refreservation is set, which affects the usedbyrefreservation value
which in turn (might / probably will) affect the used value. no relation
to discard at all.



More information about the pve-user mailing list