title: How to get total disk space in Linux with Java?
body: <p>I am able to get free disk space. How would I get the total disk space?</p>
  
  <p>My code is:</p>
  
  <pre><code>import java.io.IOException;
  
  import org.apache.commons.io.FileSystemUtils;
  
  public class DiskSpace {
      public static void main(String[] args) {
          try {
  
              //calculate free disk space
              double freeDiskSpace = FileSystemUtils.freeSpaceKb(args[0]);
              System.out.println(args[0]);
  
              //convert the number into gigabyte
              double freeDiskSpaceGB = freeDiskSpace / 1024 / 1024;
  
              System.out.println("Free Disk Space (GB):" + freeDiskSpaceGB);
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p><code>FileSystemUtils</code> do not have method for total space of disk ??? hopes for your reply</p>
  
  <p>Thanks in advance</p>