Using java, how do you get the amount of free space on the Solaris zfs file system?

Using java, how do you get the amount of free space on the Solaris zfs file system?

I have a SunFire x4140 with integrated hdd installed as /. It also has a connected JBOD with 7.6 TB of hard disk space, configured as a ZFS file system and mounted as / application.

I use java.io.File.getUsableSpace or java.io.File.getFreeSpace to get the amount of free space in the file system. On / (built-in) HDD FS is working correctly.

On / application (zfs section) File.getFreeSpace, File.getUsableSpace and File.getTotalSpace all return 0 (zero). Does anyone know why? Does java.io.File.getUsableSpace work on ZFS, and if so, how?

The following shows the zfs file system on the machine in question:

/ usr / sbin / zfs list

NAME                USED  AVAIL  REFER  MOUNTPOINT
internal            196K  98.4G     1K  none
internal/logs        18K  98.4G    18K  /logs
j4200-1             442G  7.57T  2.44K  none
j4200-1/app         442G  7.57T   153M  /app
j4200-1/app@first   442G      -   442G  - 
+3
3

, libzfs, zfs API Java

+2

df -kP ,

Apache Commons IO FileSystemUtils.freeSpaceKb( "/volume" );

df, dir Windows

+1

What does the df command say? Doesn't that also communicate the correct free space on zfs?

0
source

Source: https://habr.com/ru/post/1706582/


All Articles