SourceForge has been redesigned. Learn more.
Close

#4188 FreeBSD9.1 - ZFS - Disk Space incorrectly calculated

1.610
closed-fixed
5
2015-11-04
2013-01-24
Musclegeek
No

I installed PCBSD9.1 (Based on FreeBSD9.1) on a 16GB USB stick. The default FS is ZFS with root.

When I installed Webmin the "System Information" displays "Local disk space" as "117.74 GB total, 3.95 GB used".

This is impossible. I think Webmin is calculating all of the ZFS mounts as separate disks or FS's and adding them together.

I also noticed on FreeBSD Webmin does not show Partitions on local disks.

Discussion

<< < 1 2 (Page 2 of 2)
  • cadatoiva

    cadatoiva - 2015-09-27

    Sorry, just trying to help out. A better command for your script to run would be zfs list -H -d 0 -o name,used,avail
    zfs list gives logical values for filesystems (removing space reserved for redundancy in raidz etc)
    the -H option gives script parseable output (no headers, all outputs separated by single \t character)
    the -d option is for "depth" a depth of zero means only parent filesystems, no children are listed.
    the -o option lets you specify columns, name being the name of the pool, used is total used by the filesystem and all children, and avail being the remaining space available in the parent fs.

    Sadly, there is no column for total space in zfs list, so you'll have to add the 2 together to get total. It defaults to listing in human readable format, but with the -p flag it will list it in bytes if you need that. I really like your work. Hope this helps make it better for zfs users.

    # zfs list -H -d 0 -o name,used,avail -p
    tank    1358025205824   4252745586624
    # zfs list
    NAME                    USED  AVAIL  REFER  MOUNTPOINT
    tank                   1.24T  3.87T  73.3G  /files
    tank/Minecraft         85.3M  3.87T   209K  /files/Minecraft
    tank/Minecraft/worlds  85.1M  3.87T  85.1M  /usr/local/minecraft-server/worlds
    tank/torrents           546G  3.87T   546G  /files/Torrents
    tank/users              645G  3.87T   645G  /files/users
    
     
    Last edit: cadatoiva 2015-09-27
  • Jordan Goldman

    Jordan Goldman - 2015-10-25

    Sorry to add on to an old thread, but this is still being calculated wrong it appears. New FreeBSD 10.2-RELEASE server with RAID 1 on 2x256GB SSD drives using ZFS.

    Webmin reports:
    Local disk space 2.11 TB total / 2.07 TB free / 35.69 GB used

    Here's df -h results:
    Filesystem Size Used Avail Capacity Mounted on
    zroot/ROOT/default 195G 2.0G 193G 1% /
    devfs 1.0K 1.0K 0B 100% /dev
    zroot/tmp 193G 192K 193G 0% /tmp
    zroot/usr/home 226G 33G 193G 15% /usr/home
    zroot/usr/ports 194G 761M 193G 0% /usr/ports
    zroot/usr/src 193G 96K 193G 0% /usr/src
    zroot/var/audit 193G 96K 193G 0% /var/audit
    zroot/var/crash 193G 96K 193G 0% /var/crash
    zroot/var/log 193G 2.4M 193G 0% /var/log
    zroot/var/mail 193G 120K 193G 0% /var/mail
    zroot/var/tmp 193G 104K 193G 0% /var/tmp
    zroot 193G 96K 193G 0% /zroot

    Here's zfs list results:
    NAME USED AVAIL REFER MOUNTPOINT
    zroot 35.7G 193G 96K /zroot
    zroot/ROOT 1.96G 193G 96K none
    zroot/ROOT/default 1.96G 193G 1.96G /
    zroot/tmp 192K 193G 192K /tmp
    zroot/usr 33.7G 193G 96K /usr
    zroot/usr/home 33.0G 193G 33.0G /usr/home
    zroot/usr/ports 761M 193G 761M /usr/ports
    zroot/usr/src 96K 193G 96K /usr/src
    zroot/var 2.86M 193G 96K /var
    zroot/var/audit 96K 193G 96K /var/audit
    zroot/var/crash 96K 193G 96K /var/crash
    zroot/var/log 2.36M 193G 2.36M /var/log
    zroot/var/mail 120K 193G 120K /var/mail
    zroot/var/tmp 104K 193G 104K /var/tmp

    I wish it was 2TB of SSD space, but alas... =P

     
  • Jamie Cameron

    Jamie Cameron - 2015-10-27

    Jordan - how many different ZFS pools do you have setup there, and of what sizes?

     
  • Jordan Goldman

    Jordan Goldman - 2015-10-27

    Hey Jamie,

    Thanks for your quick response! Just the one:

    root@web:/usr/home/admin # zpool list
    NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
    zroot 236G 46.7G 189G - 11% 19% 1.00x ONLINE -

    Let me know if you need any other info!
    Best,
    Jordan

     
  • Jamie Cameron

    Jamie Cameron - 2015-10-28

    I think what's confusing Webmin is that devices like zroot/usr/home show 226G free, but zroot/ROOT/default shows 195G free. But aren't they both using the same pool?

     
  • Jordan Goldman

    Jordan Goldman - 2015-10-28

    Yes, you're right - that's a bit odd. This was a new server that I was transferring files to, so I'm not sure if there was a larger discrepancy since those commands weren't run at the same time previously, but these were both run just now:

    $ df -h
    Filesystem Size Used Avail Capacity Mounted on
    zroot/ROOT/default 183G 2.1G 181G 1% /
    devfs 1.0K 1.0K 0B 100% /dev
    zroot/tmp 181G 820K 181G 0% /tmp
    zroot/usr/home 225G 44G 181G 20% /usr/home
    zroot/usr/ports 182G 1.7G 181G 1% /usr/ports
    zroot/usr/src 181G 96K 181G 0% /usr/src
    zroot/var/audit 181G 96K 181G 0% /var/audit
    zroot/var/crash 181G 96K 181G 0% /var/crash
    zroot/var/log 181G 11M 181G 0% /var/log
    zroot/var/mail 181G 364K 181G 0% /var/mail
    zroot/var/tmp 181G 104K 181G 0% /var/tmp
    zroot 181G 96K 181G 0% /zroot
    $ zpool list
    NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
    zroot 236G 48.0G 188G - 11% 20% 1.00x ONLINE -

    No clue why free doesn't match up to available...this was a default install, so there wasn't anything unusual done on my end.

    Is there a way to patch it to at least get the disk space closer to a reasonable number (even if it's just the numbers taken out of zpool, that's better than showing 2TB, which is clearly off by a lot).

    Best,
    Jordan

     
  • Jamie Cameron

    Jamie Cameron - 2015-10-29

    Using the zpool command isn't really suitable for Webmin, because there may be pools that aren't part of any mounted filesystem.

     
  • Jamie Cameron

    Jamie Cameron - 2015-10-31

    Ok, the next release of Webmin will handle ZFS better by using the pool size to work out total used / free space, rather than the filesystem size.

     
  • cadatoiva

    cadatoiva - 2015-11-04

    The command zfs list I mentioned above only lists mounted filesystems. I tested it by unmounting select filesystems and seeing if they showed. zpool list also only shows active (mounted) pools, so it could work as well. However, zpool list as a command doesn't exclude parity space from the totals, leading to an inaccurate count. I look forward to the update.

    Thanks

     
  • Jordan Goldman

    Jordan Goldman - 2015-11-04

    Thanks Jamie! Sorry for the late response - been travelling the last few days. I appreciate your quick responses and fix! Don't hesitate to let me know if you need anything else from me to test.

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.