FAQ
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.oskin@gmail.com>
To: core-user@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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 8 | next ›
Discussion Overview
groupcommon-user @
categorieshadoop
postedAug 23, '09 at 11:22a
activeAug 25, '09 at 11:33p
posts8
users4
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2021 Grokbase