zfs size mismatch with du command

Hello,

I'm using FreeBSD 8.3-STABLE. zfs list tank0 is mismatched with du -sh /opt output. ZFS mounted to /opt, du command says 267 GB used but ZFS says 784 GB used. What can be the reason of this condition? How can I learn correct information?

du output:
Code:
network-en:/# network>  du -sh /opt
267G	/opt

zfs output:
Code:
network-en:~# network>  zfs get all
NAME       PROPERTY              VALUE                  SOURCE
tank0      type                  filesystem             -
tank0      creation              Tue Aug 27 13:52 2013  -
tank0      used                  784G                   -
tank0      available             97.7G                  -
tank0      referenced            31K                    -
tank0      compressratio         1.00x                  -
tank0      mounted               no                     -
tank0      quota                 none                   default
tank0      renvation           none                   default
tank0      recordsize            128K                   default
tank0      mountpoint            none                   local
tank0      sharenfs              off                    default
tank0      checksum              on                     default
tank0      compression           off                    default
tank0      atime                 off                    local
tank0      devices               on                     default
tank0      exec                  on                     default
tank0      setuid                on                     default
tank0      readonly              off                    default
tank0      jailed                off                    default
tank0      snapdir               hidden                 default
tank0      aclmode               discard                default
tank0      aclinherit            restricted             default
tank0      canmount              on                     default
tank0      xattr                 on                     default
tank0      copies                1                      default
tank0      version               5                      -
tank0      utf8only              off                    -
tank0      normalization         none                   -
tank0      casesensitivity       sensitive              -
tank0      vscan                 off                    default
tank0      nbmand                off                    default
tank0      sharesmb              off                    default
tank0      refquota              none                   default
tank0      refrenvation        none                   default
tank0      primarycache          all                    default
tank0      secondarycache        all                    default
tank0      usedbysnapshots       0                      -
tank0      usedbydataset         31K                    -
tank0      usedbychildren        784G                   -
tank0      usedbyrefrenvation  0                      -
tank0      logbias               latency                default
tank0      dedup                 off                    default
tank0      mlslabel                                     -
tank0      sync                  standard               default
tank0      refcompressratio      1.00x                  -
tank0      written               31K                    -
tank0/opt  type                  filesystem             -
tank0/opt  creation              Tue Aug 27 13:52 2013  -
tank0/opt  used                  784G                   -
tank0/opt  available             97.7G                  -
tank0/opt  referenced            784G                   -
tank0/opt  compressratio         1.00x                  -
tank0/opt  mounted               yes                    -
tank0/opt  quota                 none                   default
tank0/opt  renvation           none                   default
tank0/opt  recordsize            128K                   default
tank0/opt  mountpoint            /opt                   local
tank0/opt  sharenfs              off                    default
tank0/opt  checksum              on                     default
tank0/opt  compression           off                    default
tank0/opt  atime                 off                    local
tank0/opt  devices               on                     default
tank0/opt  exec                  on                     default
tank0/opt  setuid                on                     default
tank0/opt  readonly              off                    default
tank0/opt  jailed                off                    default
tank0/opt  snapdir               hidden                 default
tank0/opt  aclmode               discard                default
tank0/opt  aclinherit            restricted             default
tank0/opt  canmount              on                     default
tank0/opt  xattr                 off                    temporary
tank0/opt  copies                1                      default
tank0/opt  version               5                      -
tank0/opt  utf8only              off                    -
tank0/opt  normalization         none                   -
tank0/opt  casesensitivity       sensitive              -
tank0/opt  vscan                 off                    default
tank0/opt  nbmand                off                    default
tank0/opt  sharesmb              off                    default
tank0/opt  refquota              none                   default
tank0/opt  refrenvation        none                   default
tank0/opt  primarycache          all                    default
tank0/opt  secondarycache        all                    default
tank0/opt  usedbysnapshots       0                      -
tank0/opt  usedbydataset         784G                   -
tank0/opt  usedbychildren        0                      -
tank0/opt  usedbyrefrenvation  0                      -
tank0/opt  logbias               latency                default
tank0/opt  dedup                 off                    default
tank0/opt  mlslabel                                     -
tank0/opt  sync                  standard               default
tank0/opt  refcompressratio      1.00x                  -
tank0/opt  written

pool get listsnapshots:
Code:
network-en:~# network>  zpool get listsnapshots
NAME   PROPERTY       VALUE      SOURCE
tank0  listsnapshots  off        default

Best regards,
Vecihi
 
Code:
network-en:~# network>  zfs list
NAME        USED  AVAIL  REFER  MOUNTPOINT
tank0       834G  47.6G    31K  none
tank0/opt   834G  47.6G   834G  /opt
 
Sounds indeed like a snapshot issue. Although snapshots may not be visible in your setup this doesn't mean they're not accessible. If you made a snapshot of a filesystem then you'll still be able to access that snapshot using cd .zfs/snapshot from the root of the filesystem (so, for example, if you have any on /opt you should be able to issue cd /opt/.zfs/snapshot).

A good way to list any would be using: zfs list -rt all tank0/opt.
 
There is no snapshot. And I didn't take any snapshot.

Code:
network-en:~# network>   zfs list -rt all tank0/opt
NAME        USED  AVAIL  REFER  MOUNTPOINT
tank0/opt   855G  26.9G   855G  /opt
network-en:~# network>  ls /opt/.zfs
shares   snapshot

network-en:~# inseptra>  find /opt/.zfs
/opt/.zfs
/opt/.zfs/snapshot
/opt/.zfs/shares
 
Interesting issue.

I gave it a few tries myself and I can reproduce your results. And I can also rule out any influence of snapshots as well; on my system I keep a snapshot retention of 7 days and when checking the output of du it becomes clear that .zfs is ignored.

My situation:

Code:
root@smtp2:/var/log # zfs list zroot/var/log
NAME            USED  AVAIL  REFER  MOUNTPOINT
zroot/var/log   290M   107G   284M  /var/log
root@smtp2:/var/log # du -sh
283M    .
There are a few things to consider. The -h parameter does a bit of rounding up, and I also suspect that it may suffer from the "1024b issue" (1k versus 1024byte). I'm quite convinced that what you're looking at is a rounding issue of some sort.

Because if I don't use -h ("human readable") in my situation I get to see this:

Code:
root@smtp2:/var/log # du -s
290354  .
Which matches the amounts given by ZFS quite well.

Note that this is only an educated guess, but I'm tempted to blame rounding issues here.
 
Actually I used FreeBSD 8.2 iso's /boot/mfsroot.gz image on installation (iso: /boot/mfsroot.gz ) but I installed FreeBSD 8.3 kernel, binaries, libs. Maybe It is related with that because of ZFS version.

ISO file's /boot/kernel and rootfs's /boot/kernel directories are FreeBSD 8.3 stable.
 
Problem solved. We deleted a big data of mongodb service while mongodb is running. And filesystem didn't reallocate. When we restarted mongodb service free space re-allocated automatically.

Thanks
 
Back
Top