UniFi Video - How to Repair a Database for Linux


This article will outline how to repair a UniFi Video database under the Linux operating system (includes our hardware NVR).  If you have the software installed on Windows, the article for repairing the database can be found here.

It's important to note that the system will attempt an automatic database repair if it suspects any database corruption, caused by an incorrect shutdown for example. A user should only need to do this manually if that startup repair did not work, or if database corruption is definitely present but the auto repair didn't trigger.


1. Stop the UniFi Video service

service unifi-video stop

2. Delete the contents of the journal folder

rm -rf /usr/lib/unifi-video/data/db/journal/*

3. Switch to the unifi-video user

su unifi-video

4. Run: 

mongod --dbpath /usr/lib/unifi-video/data/db --repair

5. Exit to return to root:


6. Start the UniFi Video service:

service unifi-video start

Related Articles