Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8098757 | emb-9 | Brian Burkhalter | P4 | Resolved | Fixed | team |
Test URL: api/java_nio/file/FileStore/index.html\#FileStoreTests
JDK Version: JDK 7,8,9
Standalone Code Snippet:
import java.nio.file.*;
import java.io.IOException;
public class NIOTest {
public static void main(String[] args) throws IOException {
for (FileStore store: FileSystems.getDefault().getFileStores()) {
long total = store.getTotalSpace()/(1024*1024*1024); // Just to convert into Gi
long avail = store.getUsableSpace()/(1024*1024*1024);
System.out.format("%-20s %12d %12d%n", store, total, avail);
}
}
}
Comparing the output of shared location on Mac and Linux:
Code run on mac:
stt-mac-04:bin gtee$ ./java NIOTest
/net/stt-13.ru.oracle.com/export (stt-13.ru.oracle.com:/export) 966Gi 1903Gi
/net/stt-13.ru.oracle.com/export2 (stt-13.ru.oracle.com:/export2) 1147Gi 187Gi
Code run on Linux:
/net/stt-13.ru.oracle.com/export (stt-13.ru.oracle.com:/export) 7110Gi 1903Gi
/net/stt-13.ru.oracle.com/export2 (stt-13.ru.oracle.com:/export2) 7291Gi 187Gi
Output by df -kh :
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
stt-13.ru.oracle.com:/export2 7.1Ti 6.9Ti 188Gi 98% 58113721 393509647 13% /net/stt-13.ru.oracle.com/export2
stt-13.ru.oracle.com:/export 6.9Ti 5.1Ti 1.9Ti 74% 261224288 3991590226 6% /net/stt-13.ru.oracle.com/export
On Mac, JDK provided wrong information of getTotalSpace and it gives a value less than getUsableSpace.
JDK Version: JDK 7,8,9
Standalone Code Snippet:
import java.nio.file.*;
import java.io.IOException;
public class NIOTest {
public static void main(String[] args) throws IOException {
for (FileStore store: FileSystems.getDefault().getFileStores()) {
long total = store.getTotalSpace()/(1024*1024*1024); // Just to convert into Gi
long avail = store.getUsableSpace()/(1024*1024*1024);
System.out.format("%-20s %12d %12d%n", store, total, avail);
}
}
}
Comparing the output of shared location on Mac and Linux:
Code run on mac:
stt-mac-04:bin gtee$ ./java NIOTest
/net/stt-13.ru.oracle.com/export (stt-13.ru.oracle.com:/export) 966Gi 1903Gi
/net/stt-13.ru.oracle.com/export2 (stt-13.ru.oracle.com:/export2) 1147Gi 187Gi
Code run on Linux:
/net/stt-13.ru.oracle.com/export (stt-13.ru.oracle.com:/export) 7110Gi 1903Gi
/net/stt-13.ru.oracle.com/export2 (stt-13.ru.oracle.com:/export2) 7291Gi 187Gi
Output by df -kh :
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
stt-13.ru.oracle.com:/export2 7.1Ti 6.9Ti 188Gi 98% 58113721 393509647 13% /net/stt-13.ru.oracle.com/export2
stt-13.ru.oracle.com:/export 6.9Ti 5.1Ti 1.9Ti 74% 261224288 3991590226 6% /net/stt-13.ru.oracle.com/export
On Mac, JDK provided wrong information of getTotalSpace and it gives a value less than getUsableSpace.
- backported by
-
JDK-8098757 (fs) FileStore.getTotalSpace returns unexpected results with >2TB file systems
-
- Resolved
-
- relates to
-
JDK-8087288 File.get{Free,Total,Usable}Space may return unexpected results with >2TB file systems
-
- Closed
-