private static long getFileSize(String filePath) throws IOException {
    DU.setExecCommand(filePath);
    DU.execute();
    String size = DU.getOutput().split("\t")[0];
    return StringUtils.isEmpty(size.trim()) ? 0 : Long.parseLong(size);
  }
Using Linux command du to get file's real size
@param filePath the file
@return file's real size
@throws IOException something happened like file not exists
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/PersistentIOEngine.java