Verifying nextcloud database after restore a virtuel machine

sometimes the restore of a virtual machine from a snapshot can lead to inconsistent innoDB SQL-DBs.
Could this affect Nextcloud?
How can I check, that the Nextcloud DB is OK after a restore of a virtual machine?

If by inconsistent you mean it’s old, you can’t. It absolutely can affect nextcloud. There are some occ commands to mitigate this but the only way to know for sure would be to parse the database and compare your file system with the files the database has.

Either setup a HA cluster for nextcloud/mysql or setup mysql replication to prevent this in the future.

Depends on what you mean with “snapshot”… a running MySQL server always has a number of open files, e.g. the DB Logs among others. Performing a simple snapshot on the volume level may catch MySQL while it actually does some work and is writing data to it’s files. Well, in this case you can end up with a inconsistent database quite easily, especially on a busy server.

If you then restore that snapshop and MySQL starts up, it will try to roll-back to the last transaction, which then may work or not. This depends on what data have made it to the snapshot… Just keep in mind that snapshotting a volume which hosts any database, does not guarantee a working instance upon rollback to that snapshot. Always perform manual backups of your databases on such volume.

Btw, running a cronjob which dumps your NC database is way easier than even trying to begin setting up a HA-cluster… :wink:

1 Like