JDK-8166162 : (fs) Cannot obtain FileStore if device of path is not in /proc/mounts
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • Submitted: 2016-09-15
  • Updated: 2018-09-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Related Reports
Relates :  
Relates :  
If the class GetFileStore included below is for example run in a chroot environment it will fail with an IOException whose message is "Mount point not found".

import java.nio.file.Files;
import java.nio.file.FileStore;
import java.nio.file.Path;
import java.nio.file.Paths;

public class GetFileStore {
    public static void main(String[] args) throws Throwable {
        String userDir = System.getProperty("user.dir");
        System.out.printf("Retrieving FileStore for %s%n", userDir);
        Path path = Paths.get(userDir);
        FileStore fileStore = Files.getFileStore(path);
        System.out.printf("%s is in FileStore %s of type %s%n",
                          userDir, fileStore.name(), fileStore.type());

For example if /proc/mounts contains only

none /proc proc rw,relatime 0 0

running the above class within /home behaves as follows:

/home# java GetFileStore
Retrieving FileStore for /home
Exception in thread "main" java.io.IOException: Mount point not found
	at sun.nio.fs.LinuxFileStore.findMountEntry(java.base/LinuxFileStore.java:91)
	at sun.nio.fs.UnixFileStore.<init>(java.base/UnixFileStore.java:65)
	at sun.nio.fs.LinuxFileStore.<init>(java.base/LinuxFileStore.java:44)
	at sun.nio.fs.LinuxFileSystemProvider.getFileStore(java.base/LinuxFileSystemProvider.java:51)
	at sun.nio.fs.LinuxFileSystemProvider.getFileStore(java.base/LinuxFileSystemProvider.java:39)
	at sun.nio.fs.UnixFileSystemProvider.getFileStore(java.base/UnixFileSystemProvider.java:369)
	at java.nio.file.Files.getFileStore(java.base/Files.java:1464)
	at GetFileStore.main(GetFileStore.java:11)
This issue has not been resolved. The test class in the description output is Retrieving FileStore for /home/bpb Exception in thread "main" java.io.IOException: Mount point not found at java.base/sun.nio.fs.LinuxFileStore.findMountEntry(LinuxFileStore.java:100) at java.base/sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65) at java.base/sun.nio.fs.LinuxFileStore.<init>(LinuxFileStore.java:44) at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:51) at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:39) at java.base/sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:369) at java.base/java.nio.file.Files.getFileStore(Files.java:1479) at GetFileStore.main(GetFileStore.java:11) The content of /proc/mounts is proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 where the /proc filesystem was bound to the chroot using sudo mount -o bind /proc /var/chroot/proc

Does JDK-8165852 resolve this issue?

I am also running into this, in a docker/container.

RFC thread regarding various situations in which this problem has been observed: http://mail.openjdk.java.net/pipermail/nio-dev/2016-October/003915.html