InsideDarkWeb.com

Why is my mongo backup thrice my database size?

I have a mongodb, and there is some data inside. Now much, a bit more then 5GB.

> show dbs;
local  0.000GB
aaaa   0.034GB
bbbbb  5.327GB
> 

So I made a backup, using mongodump -h mongo --archive > mongo.tar.

However, this file is 16GB in size

[email protected]:~$ ls -lah | grep mongo
-rw-r--r-- 1 root root  16G Oct  7 12:48 mongo.tar

Which is more then three times bigger then reported dataset size. I can compress it, of course, but I would like to know why is the backup so big in the first place.

Server Fault Asked by M4ks on November 14, 2021

2 Answers

2 Answers

Databases use sparse files which don't automatically re-use cleared storage. You will need to compact the file to reduce its size, mongo can achieve this with the '--repair' option

Answered by Bert on November 14, 2021

You can use --gzip flag to compress the output file.

Answered by EC Tan on November 14, 2021

Add your own answers!

Related Questions

inactive option not working for pam_lastlog.so

1  Asked on August 5, 2020 by jakov-sosic

     

IPVS transmitting packets to incorrect backends

0  Asked on August 1, 2020 by vignesh-sp

         

Curl to host and port not working from inside Docker container

0  Asked on July 26, 2020 by bhanu-praveen-g

   

rsync unexpected remote arg: [email protected]:/path

2  Asked on July 21, 2020 by pdiracdelta

   

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.