SOLVED ZFS pool size is not shown at SMB shares

s0mm3r

Dabbler
Joined
Jul 25, 2018
Messages
31

s0mm3r

Dabbler
Joined
Jul 25, 2018
Messages
31
Last edited:

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421

s0mm3r

Dabbler
Joined
Jul 25, 2018
Messages
31
Put it in the GUI auxillary parameters box.
just edited my post
I've added it there
but it does not help :(
still not showing the actual size

I'm using this script
the script is executeable
Code:
#!/bin/bash

CURPATH=`pwd`

USED=$((`zfs get -o value -Hp used $CURPATH` / 1024)) > /dev/null
AVAIL=$((`zfs get -o value -Hp available $CURPATH` / 1024)) > /dev/null
TOTAL=$(($USED+$AVAIL)) > /dev/null
echo $TOTAL $AVAIL


and that seems to be it
because it uses "pwd" to get the path
manually specifying the path results in different sizes
Code:
root@freenas:/ # bash /usr/local/etc/dfree /mnt/Media
11300990975 4629843912
root@freenas:/ # bash /usr/local/etc/dfree /mnt/Media/Filme
6890274094 4629843912
root@freenas:/ #

but even if I use '/mnt/Media' in the script which results in '11300990975 4629843912'
it does not report that values to the windows client
 
Last edited:

s0mm3r

Dabbler
Joined
Jul 25, 2018
Messages
31
but even if I use '/mnt/Media' in the script which results in '11300990975 4629843912'
it does not report that values to the windows client
there was an issue with the encoding
I've deleted the file and recreated it
now the smb service does report the correct share size
I just have to modify the script
so that it will work on all datasets :)
I will post it when finished
 
Last edited:

s0mm3r

Dabbler
Joined
Jul 25, 2018
Messages
31
this is the script I'm using
quick and dirty but works
it gets the pools values and reports them to the windows clients
Code:
#!/bin/bash
#origin from: http://stanislavs.org/reporting-correct-space-usage-for-samba-shared-zfs-volumes

SUC=0
CURPATH=`pwd`

POOL1=/mnt/Data
POOL2=/mnt/Media

echo $CURPATH | grep $POOL1 >> /dev/null
if [[ $? == $SUC ]] ; then
    CURPATH=$POOL1
fi

echo $CURPATH | grep $POOL2 >> /dev/null
if [[ $? == $SUC ]] ; then
    CURPATH=$POOL2
fi

USED=$((`zfs get -o value -Hp used $CURPATH` / 1024)) > /dev/null
AVAIL=$((`zfs get -o value -Hp available $CURPATH` / 1024)) > /dev/null
TOTAL=$(($USED+$AVAIL)) > /dev/null
echo $TOTAL $AVAIL

it is stored as '/path/to/script/dfree'
and I've added this line to the smb aux parameters
Code:
dfree command = /path/to/script/dfree
 
Last edited:

julesq

Cadet
Joined
Sep 1, 2017
Messages
6
is this still working for you? I've followed the steps and while when I run the script in CLI it reports the correct Total and Available space, when I add dfree command to the smb aux parameters Windows just reports 0 bytes for both figures. wondering if something has changed in implementation in the last 2.5 years?
 

IhatemyISP

Cadet
Joined
Mar 5, 2023
Messages
1
is this still working for you? I've followed the steps and while when I run the script in CLI it reports the correct Total and Available space, when I add dfree command to the smb aux parameters Windows just reports 0 bytes for both figures. wondering if something has changed in implementation in the last 2.5 years?
I know this is almost 2 years too late but I've figured it out.

Change "zfs" to "/usr/local/sbin/zfs" in the script.

Code:
#!/bin/bash
#origin from: http://stanislavs.org/reporting-correct-space-usage-for-samba-shared-zfs-volumes

SUC=0
CURPATH=`pwd`

POOL1=/mnt/tank
POOL2=/mnt/trash

echo $CURPATH | grep $POOL1 >> /dev/null
if [[ $? == $SUC ]] ; then
    CURPATH=$POOL1
fi

echo $CURPATH | grep $POOL2 >> /dev/null
if [[ $? == $SUC ]] ; then
    CURPATH=$POOL2
fi

USED=$((`/usr/local/sbin/zfs get -o value -Hp used $CURPATH` / 1024)) > /dev/null
AVAIL=$((`/usr/local/sbin/zfs get -o value -Hp available $CURPATH` / 1024)) > /dev/null
TOTAL=$(($USED+$AVAIL)) > /dev/null
echo $TOTAL $AVAIL
 
Top