Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:47:02+00:00 2026-06-17T16:47:02+00:00

When I want to see the total free space on my android I would

  • 0

When I want to see the total free space on my android I would typically look at both the internal storage and the external storage(SD Card) .

Based on what I read in some of the SO answers I would find internal storage data (free space, available space etc.) like this:

 File path            = Environment.getDataDirectory();
 StatFs stat          = new StatFs(path.getPath());
 long blockSize       = stat.getBlockSize();
 long totalBlocks     = stat.getBlockCount();
 long availableBlocks = stat.getAvailableBlocks();
 //Logging added to make sure I am not going mad
 Log.v(TAG,"Available Blocks: "+Long.toString(availableBlocks));
 Log.v(TAG,"Total Blocks: "+Long.toString(totalBlocks));
 Log.v(TAG,"Block size: "+Long.toString(blockSize));

If I wanted to get the external storage(SD Card) of my android device I would run code like this:

  FilePath path           = Environment..getExternalStorageDirectory();
  StatFs stat             = new StatFs(Environment.getPath());
  this.extblockSize       = stat.getBlockSize();
  long exttotalBlocks     = stat.getBlockCount();
  long extavailableBlocks = stat.getAvailableBlocks();
  //More logging to ensure I am not mad!
  Log.v(TAG,"EXTAvailable Blocks: "+Long.toString(extavailableBlocks));
  Log.v(TAG,"EXTTotal Blocks: "+Long.toString(exttotalBlocks));
  Log.v(TAG,"EXTBlock size: "+Long.toString(extblockSize));

Am I right in saying this is how you read external and internal storage on a android device?

Assuming I am right I have a bit of a problem. When I run the above code on my Samsung Galaxy SIII the above pieces of code return exactly the same amount of memory. Now I know my Samsung has about 25GB internal memory and I have a 4GB SD card in.

However both these pieces of code returns the 25GB total which is correct and 23GB free which is also correct but only for the internal storage. I just for the life of me cant figure out how to read the file system information for the SD card. See the log output below for actual values being output.

01-14 20:49:25.485: V/VLRApplication(730): Available Blocks: 6031460
01-14 20:49:25.485: V/VLRApplication(730): Total Blocks: 6702651
01-14 20:49:25.485: V/VLRApplication(730): Block size: 4096

01-14 20:49:25.485: V/VLRApplication(730): EXTAvailable Blocks: 6031460
01-14 20:49:25.485: V/VLRApplication(730): EXTTotal Blocks: 6702651
01-14 20:49:25.485: V/VLRApplication(730): EXTBlock size: 4096

So I must be misunderstanding this concept. Can someone please clarify this for me? Does the call to Environment.getExternalStorageDirectory() not set the path to the SD card? Just on a side note I have not tried this in the AVD emulated devices.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:47:03+00:00Added an answer on June 17, 2026 at 4:47 pm

    Most people’s concept of external differs from Google’s. The internal space is counted as the external storage directory, along with the SD card.

    The problem is, physical SD cards are mounted inside the same file system, and the location varies by manufacturer/ROM. Here and here are some questions concerning this issue. Unfortunately, there doesn’t seem to be a device-universal solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to see a list of all changes the next push would do.
I am working on a network based application. I want to see the memory
I have two arrays and I want to see the total number of matches,
see i want to count total no of code line, comment line in my
I want see the source code of System.Web.Routing.RouteValueDictionary class. But Reflector can't disassemble it
I want to see if a time I read from a db overlaps with
I want to see the source of functions like ns_initparse(), res_search() etc. Where can
I want to see class, function and variable/property, dependencies visually, like NDepend , but
I want to see how my #include files be processed when Microsoft Visual Studio
I want to see how many rows my delete query effects so I know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.