Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the available free space in mongodb

Tags:

mongodb

I am newly starting on mongodb. I know that by default, mongodb pre allocated data files in the order of 64MB, 128MB, 256MB, ....2GB, 2GB, 2GB....etc

Now let us supposed i have a mongo instance that is preallocated with 64MB and 128MB for each of the different collections. Now I would like to know the below

  • How to check the available free space in the 128MB file of each collections?
  • How to check the total size of all the collections, data bases?
  • How to check the total available free space out of allocated?
like image 328
Uday Avatar asked Jan 30 '12 07:01

Uday


1 Answers

Checking free space in the internal storage files of mongo is not something you normally (or at all) do.

Mongo provides a number of functions which you can use to check the size of collections and some helpful scripts demonstrating how to run the functions on each database on the server.

You can also wrap such functions in a script to make reading easier, such as this script which lists the size and counts for all collections in a database.

like image 72
AD7six Avatar answered Sep 19 '22 00:09

AD7six