This article will outline how to repair a UniFi Video database for both Linux or Windows platforms.
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.
Table of Contents
- Steps: How to Repair the Database on Linux
- Steps: How to Repair the Database on Windows
- Related Articles
Steps: How to Repair the Database on Linux
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:
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
Steps: How to Repair the Database on Windows
1. Stop the UniFi Video service (Right click on the icon in the notifications area and choose Stop)
2. Open Windows Explorer, browse to C:\ProgramData\unifi-video\data\db\journal. Delete all files within this folder, leaving the folder present, but empty
3. Open a command prompt as Administrator (+r, and type ‘cmd’. Right click on the command prompt and choose “Run as Administrator”)
mongod.exe --dbpath C:\ProgramData\unifi-video\data\db --repair
Once the command completes, it will bring you back to the command prompt. Wait until it has done so, before continuing to the next step.
6. Start the UniFi Video service (Right click on the icon in the notifications area and choose Start)