How to back up a MongoDB database, step by step
Updated 7/20/2026
MongoDB gives you mongodump for compressed, easy-to-restore backups. Here is the full process.
1. Manual backup with mongodump
A single database, compressed into an archive:
mongodump --db mydb --gzip --archive=mydb-$(date +%F).archive
The whole instance:
mongodump --gzip --archive=all-$(date +%F).archive
2. Restore
mongorestore --gzip --archive=mydb-2026-07-18.archive
3. Automate with cron
0 3 * * * mongodump --db mydb --gzip --archive=/mnt/backup/mydb-$(date +\%F).archive
Keep copies on a Backup Box
Mount a Backup Box as an extra disk and write the archives straight there, off-server. The address, username and password are on the Backup Box page in your panel.
Mount as an extra disk (SMB)
apt-get install -y cifs-utils
mkdir -p /mnt/backup
mount -t cifs //BACKUP_BOX_ADDRESS/backup /mnt/backup -o username=USER,password=PASSWORD,vers=3.0
Mount over SFTP (SSHFS)
apt-get install -y sshfs
sshfs -p 22 USER@BACKUP_BOX_ADDRESS:/ /mnt/backup
With backups on the Backup Box, you are protected even if the server fails completely. See also the general backup guide.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to mount a Backup Box on Windows and share it with users
Mount a Backup Box as a network drive on Windows via SMB and share it with your team: common storage, accessible like a normal disk.
Updated 7/20/2026BackupHow to back up a Laravel application, step by step
A complete Laravel backup: code, .env, storage and database, plus how to send it all to a Backup Box mounted as an extra disk.
Updated 7/20/2026BackupHow to back up a PostgreSQL database, step by step
A complete PostgreSQL backup guide: pg_dump, cron automation and how to send copies to a Backup Box mounted as an extra disk.
Updated 7/20/2026