Stupid question regarding ZFS and `df -h` output

Brandon J. Wandersee brandon.wandersee at gmail.com
Sun Apr 10 17:40:08 UTC 2016


Aleksander Alekseev writes:
> $ sudo gpart show
> Password:
> =>       34  250069613  ada0  GPT  (119G)
>          34          6        - free -  (3.0K)
>          40       1024     1  freebsd-boot  (512K)
>        1064        984        - free -  (492K)
>        2048    4194304     2  freebsd-swap  (2.0G)
>     4196352  245872640     3  freebsd-zfs  (117G)
>   250068992        655        - free -  (328K)
>
> $ sudo zpool status
>   pool: zroot
>  state: ONLINE
>   scan: none requested
> config:
>
> 	NAME        STATE     READ WRITE CKSUM
> 	zroot       ONLINE       0     0     0
> 	  ada0p3    ONLINE       0     0     0
>
> errors: No known data errors
> ```
>
> Right, there is a swap partition. But I personally still don't
> understand why ZFS partitions size is 117G and `df` shows weird numbers
> like 95G and 74G. 

`df` will show you the correct amount of consumed and available space on
a ZFS filesystem, but not the correct "size" of a filesystem, because
(unless you've set a quota on a ZFS filesystem) there is no real "size."
ZFS handles space differently than traditional filesystems, and since a
ZFS pool fills the entirety of a disk partition, the "size" output of
`df` doesn't really matter. If it were to display the "size" accurately,
it would still show every "partition" as having the same size, totalling
several times the size of your disk.

The built-in equivalent `zfs list` doesn't even bother listing size,
because it's irrelevant.

-- 

::  Brandon J. Wandersee
::  brandon.wandersee at gmail.com
::  --------------------------------------------------
::  'The best design is as little design as possible.'
::  --- Dieter Rams ----------------------------------


More information about the freebsd-questions mailing list