Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: offer the value of getUsableSpace() #875

Closed
rwalkerands opened this issue Nov 21, 2019 · 2 comments
Closed

Enhancement: offer the value of getUsableSpace() #875

rwalkerands opened this issue Nov 21, 2019 · 2 comments

Comments

@rwalkerands
Copy link

The data for the "Free disk space" graph is based on the value of getFreeSpace(). (See JavaInformations.java.) At least on Linux/Unix this value includes both the free space for block usage and for inodes. In practice, you will almost certainly run out of block usage first, and have a lot of inode space left over that you can't use.

For example, javamelody is currently telling me that I have 22 G of disk space free. But the output of df tells me that I only have 15 G free; the other 7 G is certainly "free", but it is allocated for inodes.

The getUsableSpace() method does return 15 G in my case. Test program:

import java.io.File;

public class freespace {

    public static void main(String[] args) {
	File file = new File(".");
	System.out.println("getFreeSpace: " + file.getFreeSpace());
	System.out.println("getUsableSpace: " + file.getUsableSpace());
    }

}

Output:

getFreeSpace: 22095831040
getUsableSpace: 15895654400

So, would it be possible to have the value of getUsableSpace() recorded and graphed, either as well as, or instead of, getFreeSpace()?

@evernat
Copy link
Member

evernat commented Nov 22, 2019

Done by 6eb6c99 and ready for the next release (1.81).
A snapshot build is available at:
http://javamelody.org/downloads/javamelody-core-1.81.0-SNAPSHOT.jar

@evernat evernat closed this as completed Nov 22, 2019
@rwalkerands
Copy link
Author

Works for me, thank you!

goldyliang pushed a commit to goldyliang/javamelody that referenced this issue Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants