This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes FileStore Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "FileStore" Watch "FileStore" New topic
Author

FileStore

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


Total space = 20 Gb
Unallocated space = 5 Gb
Used space = 15 Gb
Free space = 5 Gb

if it is then my volume should be 25 gb capacity, total=used+free+unallocated

I don't think there is any unallocated space on my volume D then what is it showing ?


[Thumbnail for untitled.JPG]



My one regret in life is that I am not someone else.
- Woody Allen
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
Perhaps this: "total=used+free+unallocated" is not correct, because usable/free space and unallocated space are not mutually exlcusive.


Ping & DNS - my free Android networking tools app
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Ulf Dittmer wrote:Perhaps this: "total=used+free+unallocated" is not correct, because usable/free space and unallocated space are not mutually exlcusive.


I'm not getting your point, please explain little bit more. thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
My point is that your assumption that "total=used+free+unallocated" may be incorrect. The javadocs do a bad job of explaining what the difference between "unused" and "unallocated" disk space might be; it's certainly not clear to me (and, I suspect, might vary between different file systems),
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
The API docs state the returned values are a hint and not a guarantee.

As Ulf has said the docs are not clear on what exactly these terms relate to but unallocated space on a physical hard drive is space which hasn't been allocated to a volume yet and if this is what getUnallocatedSpace() is returning then that is why it doesn't show up on the windows file properties dialog.
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Thank you very much guys.
 
wood burning stoves
 
subject: FileStore
 
Similar Threads
Need to Calculate folder size
How to read drive letter. i.e (c:, d:, e:) when drive is labelled
java heap memory check
regarding physical memory
"Protect" a pen drive from malware using java code - please review my (working) code ?