I had initially carried out a virtualmin backup and restore and everything reported as having completed successfully, however on checking the PG database I found there were missing records. So I thought I’d manually backup and restore the DB instead, however on trying to do that I get:
Failed to backup database : pg_dump failed :
bash: /home/db_repository/name.sql: Permission denied
Scheduled backup for database left disabled.
Update: the manual db dump and restore worked with all records intact. Not sure if the team want to look into this but the concerning thing is if we had to rely on a virtualmin backup after a failure we would have lost data : /
Do the backups (Virtualmin > Backup & Restore > Scheduled Backups) use the same command as the manual dump (Virtualmin > Domain > Edit Databases > Manage > Backup) when dumping the PG database?
Here’s what I used to create the backup (which was used for restore - and what had records missing):
The user that creates the backup is postgres so creating the /home/db_repository/ folder then:
chown -R postgres:postgres db_repository
Successfully carries out the backup as expected. However, since the virtualmin scheduled backups only backup up domain accounts that means these backups would not get backed up via the scheduled backups, so naturally you’d want to specify the backup directory as:
/home/domain-account/db_repository/
But you then get the same failure when attempting a backup, even if db_repository has been chown to postgres:postgres or even if you chmod 777 /home/domain-account/db_repository.
Are you saying that when you do a Virtualmin backup (not a PostgreSQL dump independent of Virtualmin, either in the CLI or via the Webmin PostgreSQL module) you have this permission problem and this directory is only used for Virtualmin backups (and not any other kind of backup using other tools)? If you’re using this directory for multiple kinds of backup (Virtualmin backups and some other kind of database dump), that would be a complicated idea, maybe a bad one.