Find size and free space of the filesystem containing a given file

This doesn’t give the name of the partition, but you can get the filesystem statistics directly using the statvfs Unix system call. To call it from Python, use os.statvfs(‘/home/foo/bar/baz’). The relevant fields in the result, according to POSIX: unsigned long f_frsize Fundamental file system block size. fsblkcnt_t f_blocks Total number of blocks on file system … Read more

ElasticSearch find disk space usage

The Elasticsearch way to do this would be to use _cat/shards and look at the store column: curl -XGET “http://localhost:9200/_cat/shards?v” index shard prirep state docs store ip node myindex_2014_12_19 2 r STARTED 76661 415.6mb 192.168.1.1 Georgianna Castleberry myindex_2014_12_19 2 p STARTED 76661 417.3mb 192.168.1.2 Frederick Slade myindex_2014_12_19 2 r STARTED 76661 416.9mb 192.168.1.3 Maverick myindex_2014_12_19 … Read more

Get free disk space

this works for me… using System.IO; private long GetTotalFreeSpace(string driveName) { foreach (DriveInfo drive in DriveInfo.GetDrives()) { if (drive.IsReady && drive.Name == driveName) { return drive.TotalFreeSpace; } } return -1; }

Why is docker image eating up my disk space that is not used by docker

Deleting my entire /var/lib/docker is not ok for me. These are a safer ways: Solution 1: The following commands from the issue clear up space for me and it’s a lot safer than deleting /var/lib/docker or for Windows check your disk image location here. Before: docker info Example output: Metadata file: Data Space Used: 53.38 … Read more

Android get free size of internal/external memory

Below is the code for your purpose : public static boolean externalMemoryAvailable() { return android.os.Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED); } public static String getAvailableInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSizeLong(); long availableBlocks = stat.getAvailableBlocksLong(); return formatSize(availableBlocks * blockSize); } public static String getTotalInternalMemorySize() { File path = Environment.getDataDirectory(); StatFs stat … Read more

How to detect total available/free disk space on the iPhone/iPad device?

UPDATE: Since a lot of time has passed after this answer and new methods/APIs have been added, please check the updated answers below for Swift etc; Since I’ve not used them myself, I can’t vouch for them. Original answer: I found the following solution working for me: -(uint64_t)getFreeDiskspace { uint64_t totalSpace = 0; uint64_t totalFreeSpace … Read more

Android SDK folder taking a lot of disk space. Do we need to keep all of the System Images?

System images are pre-installed Android operating systems, and are only used by emulators. If you use your real Android device for debugging, you no longer need them, so you can remove them all. The cleanest way to remove them is using SDK Manager. Open up SDK Manager and uncheck those system images and then apply. … Read more

tech