vnStat – Database load failed even when using backup
So, you've run into a problem with vnStat. Yeah. Me too, after an unexpected reboot of a server the vnStat database became corrupt and was no longer usable. It's a shame that I lost all my bandwidth history (yes, I know, you can use a cronjob to dump the stats to a file every now and then and probably avoid this) but really it's not the end of the world. In any case, after a bit of looking around I've managed to find a solution.
Note: This is written for a Debian system and pathing may vary on other systems so take note of that.
1) Your database file has become corrupt. You'll find it in /var/lib/vnstat/interfacename.
2) Remove or move this file: rm /var/lib/vnstat/interfacename.
3) Now that you've got a clean slate, run the initialization command for the interface again: vnstat -u -i interfacename
4) You should see something like this:
Error: Unable to read database "/var/lib/vnstat/eth0".
Info: -> A new database has been created.
5) Your new database is created and should start refreshing your vnstat data once again.
That should be all you need for this one. Happy serving!
0 Comments