UniFi Video - How to Repair a Database for Linux


Overview


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.

NOTES & REQUIREMENTS:
UniFi Video 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.

Steps: Repairing the Database


 

Back to Top

Follow the steps below to repair the database, you must first SSH into UniFi Video, and then enter the commands described in each step.

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:

exit

6. Start the UniFi Video service:

service unifi-video start

Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH

UniFi Video - How to Repair a Database for Windows