0

df and du provides a total view of usage but the problem with these is that they are not broken down per user.

Is there a tool that does this? I found quot but that only works on ufs. Is there an equivalent for zfs or nfs?

To breakdown the usage, it is possible to write a script. Is that the only alternative?


The output from zfs userspace filesystem

$ zfs userspace filesystem
cannot access dataset filesystem: dataset does not exist

The output from zpool upgrade -v

$ zpool upgrade -v
This system is currently running ZFS pool version 32.

The following versions are supported:

VER  DESCRIPTION
---  --------------------------------------------------------
 1   Initial ZFS version
 2   Ditto blocks (replicated metadata)
 3   Hot spares and double parity RAID-Z
 4   zpool history
 5   Compression using the gzip algorithm
 6   bootfs pool property
 7   Separate intent log devices
 8   Delegated administration
 9   refquota and refreservation properties
 10  Cache devices
 11  Improved scrub performance
 12  Snapshot properties
 13  snapused property
 14  passthrough-x aclinherit
 15  user/group space accounting
 16  stmf property support
 17  Triple-parity RAID-Z
 18  Snapshot user holds
 19  Log device removal
 20  Compression using zle (zero-length encoding)
 21  Reserved
 22  Received properties
 23  Slim ZIL
 24  System attributes
 25  Improved scrub stats
 26  Improved snapshot deletion performance
 27  Improved snapshot creation performance
 28  Multiple vdev replacements
 29  RAID-Z/mirror hybrid allocator
 30  Reserved
 31  Improved 'zfs list' performance
 32  One MB blocksize
user55570
  • 458
  • 6
  • 18

2 Answers2

1

For zfs, per the zfs man page, use zfs userspace filesystem to get a listing for all users on a file system, and use zfs get [-r] userused@user filesystem to get space used by a particular user on a filesystem. Use the -r option to zfs get ... to get user usage on all descendents of the filesystem, too. Be aware that this will return not just descendent filesystems but descendent clones and snapshots, too.

As far as I know, NFS does not support such operations directly - that will have to be done via the native file system on the NFS server.

Andrew Henle
  • 1,262
  • 9
  • 11
  • the zfs userspace command returns `cannot access dataset ...: dataset does not exist` – user55570 Jun 19 '15 at 20:54
  • What's the output from `zfs get version`? – Andrew Henle Jun 20 '15 at 01:33
  • The result is zfs version 5 – user55570 Jun 20 '15 at 04:18
  • Something isn't making sense then - the `userspace` and `userused` features should be available at version 4. What's the output from `zpool upgrade -v`? That should provide a list up to about version 35 depending on what you're running, with user/group space accounting appearing at version 15. – Andrew Henle Jun 20 '15 at 10:57
  • Added the output of `zpool upgrade -v` to original post. – user55570 Jun 20 '15 at 11:28
  • Did you replace `filesystem` with the actual name of a ZFS filesystem? Like `zfs userspace rpool`? – Andrew Henle Jun 20 '15 at 11:49
  • Tried doing it that way now--i.e. `zfs userspace rpool`. It returns a used space value that seems abnormally small. e.g. space used by root is 80k on rpool – user55570 Jun 20 '15 at 12:08
  • That's because `rpool` isn't really one of the filesystems mounts. Use `zfs list` to see all your filesystems, mounted and unmounted. Your root filesystem space usage can probably be shown with something like `zfs userspace rpool/ROOT/solaris`. – Andrew Henle Jun 20 '15 at 16:05
0

To answer your specific question, "What are the BEST ways to monitor and report disk usage on Solaris", that would not actually be in the form of a specific set of commands or a shell script, but more like a third party agent that is installed on your system in order to keep tabs on the statistics.

Two products in particular that do this extremely well are NetIQ and Compuware's dynaTrace, both of which are excellent products for enterprise environments and provide extremely detailed reports. They also have great alerting features, APIs, and even integrate with multiple other products and support ticketing systems.

Additionally, these products are great for capacity planning and are able to nail down disk usage statistics to as granular a level as you could possibly want or need. They also both specifically support ZFS file systems on numerous versions of Solaris.

rubynorails
  • 389
  • 3
  • 14