List Windows FileStores misses named mounts

Bernd Eckenfels ecki at
Sat Jul 28 20:42:47 UTC 2018


I noticed that fs.getRootDirectories() or fs.getFileStores() on Windows only list the Windows drives, but not other disks mounted on a path.

When I do the following I actually do get a FileStore for a Name-mounted FS:

        FileSystem fs = FileSystems.getDefault();
        Iterable<FileStore> rootStores = fs.getFileStores();

        Path disk = Paths.get("C:", "temp", "disk").toAbsolutePath(); // mountpoint
        FileSystemProvider fsp = FileSystemProvider.installedProviders().get(0);
        FileStore fss = fsp.getFileStore(disk);

this is the result on my Windows (USB+Virtual Drive Name mounted)

root dir C:\
root dir D:\

(C:)                                     (NTFS)      17.658,68 MB 243.303,05 MB rw r?=false cd?=false vsn=N/A on C:\
MYLINUXLIVE (D:)                         (FAT32)        226,73 MB     957,50 MB rw r?=true cd?=false vsn=N/A on D:\
vdisk (C:\temp\disk)                     (NTFS)           3,27 MB       7,00 MB rw r?=false cd?=false vsn=N/A on C:\temp\disk


Is there a reason why named Mounts are not listed and is there a cleaner way (without going through the FSP SPI) to get to its FileStore

Also what I noticed is that the „root“ member in WindowsFileSystem is the identifying part but there is no API (other than parsing .toString()) to get to it?


More information about the core-libs-dev mailing list