请问怎么获取 centos的各个 分区 的大小 用Java代码实现

本地 跑起来tomcat ,数据库只有 一个分区 ;
我在网上找的 File[] roots = File.listRoots(); 遍历之后 只取到了 '/' 分区 ,请问其它分区 怎么获取

用root权限执行程序

主要是用来统计大小的,最后用了个笨方法,直接指定分区,去统计分区存储大小

//获取linux下磁盘大小
@SuppressWarnings("null")
private void getLinuxDisk(ServerRunStatistics addServerRunStatistics) {
ServerDiscSizeManager discSizeManager = (ServerDiscSizeManager) getBean("serverDiscSizeManager");
ServerDiscSize serverDiscSize = null;
String pathString ="";
pathString= Constants.LINUX_PATH_DISK;//根据书写路径去获取分区
if (!pathString.equals("")) {
String[] path = pathString.split(",");
for (int i = 0; i < path.length; i++) {

             File f = new File(path[i]);  
             long total = f.getTotalSpace();  
             long free = f.getFreeSpace();  
             long used = total - free;  
             float usage = (float)used/total; 


             if (path[i]!=null&&!path[i].equals("")&&total!=-1&&free!=-1&&free!=-1) {
                 serverDiscSize=new ServerDiscSize();
                 serverDiscSize.setDriveletter(path[i]+"");//盘符
                 serverDiscSize.setActualsize(total/1024/1024);//实际大小
                 serverDiscSize.setRessize(free/1024/1024);//剩余存储空间量  MB
                 serverDiscSize.setPercentage( values(total/1024/1024,used/1024/1024));
                 serverDiscSize.setCreatetime(DateTime.getDate());
                 serverDiscSize.setStaticuuid(Integer.parseInt(addServerRunStatistics.getStaticid()));

                 discSizeManager.addServerDiscSize(serverDiscSize);
            }
         }
     }

}