What's the difference between getUsableSpace and getUnallocatedSpace of FileStore class

what'd
what w
what does
how to pronounce what
what is called
what's
what is love
what h

I've read the definition in the documentation and performed some searches on the Internet, but it is still not clear to me. What's the difference between getUsableSpace() and getUnallocatedSpace() in the FileStore class?

From the FileStore class documentation

getUnallocatedSpace() Returns the number of unallocated bytes in the file store.

getUsableSpace() Returns the number of bytes available to this Java virtual machine on the file store.

So there is possibly more unallocated space than usable space.

You can test it with the following code snippet

import java.io.IOException;
import java.nio.file.FileStore;
import java.nio.file.FileSystems;

public class TestFileStore {
    public static void main(String[] args) throws IOException {
        for (FileStore fileStore : FileSystems.getDefault().getFileStores()) {
            System.out.println(fileStore.name());
            System.out.println("Unallocated space: " + fileStore.getUnallocatedSpace());
            System.out.println("Unused space: " + fileStore.getUsableSpace());
            System.out.println("************************************");
        }
    }
}

This is an excerpt of my output

************************************
tmpfs
Unallocated space: 206356480
Unused space: 206356480
************************************
/dev/sda6
Unallocated space: 1089933312
Unused space: 790126592
************************************

What, what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more. Quickly send and receive WhatsApp messages right from your computer.

From peeking at the documentation, I would assume that getUsableSpace is oriented toward the current java vm, while getUnallocatedSpace refers to all unallocated space on the file store.

what, Usage Note: When what is the subject of a clause, it takes a singular verb if the word or phrase that completes the sentence (the complement) is singular, as in I � What definition, (used interrogatively as a request for specific information): What is the matter? See more.

getUsableSpace: Returns the number of bytes available to this Java virtual machine on the file store. on the file store.

getUnallocatedSpace: Returns the number of unallocated bytes in the file store.

Note that bytes available to this JVM can be less than the unallocated space, for write permissions and other operating system restrictions.

WHAT, B) A phrase that seems to simply state the obvious but actually means "it will be what it is," as Duration: 48:27 Posted: Jan 7, 2016 what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more.

What, Quickly send and receive WhatsApp messages right from your computer. whatever: adverb at all , of any description , of any kind or sort , whatsoever , whichever

It is what it is, WhatsApp Business is a free to download app that was built with the small business owner in mind. Create a catalog to showcase your products and services. The ORIGINAL and OFFICIAL "What What (In the Butt)" video! Samwell will CALL your friends and family! Go here: http://officialsamwell.com/live-call/ This is

WhatsApp Web, Three common work practices can help us decide what to continue doing — and what to ditch. Have an overarching mission or purpose. Set� WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.

Comments
  • My experience is on Windows getUnallocatedSpace() == getUsableSpace() but on Linux, ext filesystems reserve 5% of the space for root (serverfault.com/questions/228514/free-disk-vs-available-disk). So a non-root user on Linux using an ext filesystem will see a difference between getUnallocatedSpace() and getUsableSpace().