You can try something like this:
if (_FileSystem instanceof DistributedFileSystem) { DistributedFileSystem dfs = (DistributedFileSystem) _FileSystems; DiskStatus ds = dfs.getDiskStatus(); long capacity = ds.getCapacity(); long used = ds.getDfsUsed(); long remaining = ds.getRemaining(); long presentCapacity = used + remaining; hdfsPercentDiskUsed = Math.round((((1.0 * used) / presentCapacity) * 100)); } Arvind ________________________________ From: Stas Oskin <stas.os...@gmail.com> To: core-u...@hadoop.apache.org Sent: Sunday, August 23, 2009 4:22:26 AM Subject: Getting free space percentage on DFS Hi. How can I get the free / used space on DFS, via Java? What are the functions that can be used for that? Note, I'm using a regular (non-super) user, so I need to do it in a similar way to dfshealth.jsp, which AFAIK doesn't require any permissions. Thanks in advance.