File.getUsableSpace () does not return the same value as the df command in Linux

I want to print the number of bytes of the total free space of a partition using File.getUsuableSpace(), but it returns a different value than the df command (on Linux).

It is not much different, but it is distinguished by a few megabytes.

What could be?

+3
source share
2 answers

Is the file that your file instance represents in the same section as the one on which df is running?

From docs : "Returns the number of bytes available to this virtual machine in the section with a name along this abstract path "

The emphasis is mine.

+2
source

, getFreeSpace() . Java 1.6, .

0

All Articles