Skip to content

Instantly share code, notes, and snippets.

@eribeiro
Created May 9, 2013 17:41
Show Gist options
  • Save eribeiro/5549144 to your computer and use it in GitHub Desktop.
Save eribeiro/5549144 to your computer and use it in GitHub Desktop.
Java 7 NIO
FileSystem fs = FileSystems.getDefault();
for (FileStore e : fs.getFileStores()) {
System.out.println(e.name() + " " + e.getTotalSpace() + " " + e.type());
}
On my box returns:
/dev/sda1 488306122752 ext4
proc 0 proc
sysfs 0 sysfs
none 0 fusectl
none 0 debugfs
none 0 securityfs
udev 1925484544 devtmpfs
devpts 0 devpts
tmpfs 773984256 tmpfs
none 5242880 tmpfs
none 1934950400 tmpfs
none 104857600 tmpfs
cgroup 1934950400 tmpfs
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
cgroup 0 cgroup
binfmt_misc 0 binfmt_misc
none 1934950400 tmpfs
gvfsd-fuse 0 fuse.gvfsd-fuse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment