nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

Backup of database only

Open jandamm opened this issue 5 years ago • 7 comments

Description
I'm using NCP with S3 as primary storage. If I'm informed right, when my sd-card breaks or my nc-database is corrupted my files aren't readable at all. To reduce the risk, I would like to make regular backups of my database. While this is currently possible as part of the nc-backup-auto, the backup files are about 150MB for my setup (which is pretty basic). The Database would be much smaller. So I'd love to make a regular backup of the database only.

The restoration could be to replace the database file inside the .tar.gz file or by a new nc-restore-db option. Then you would have to nc-restore and then nc-restore-db

jandamm avatar Nov 23 '19 22:11 jandamm

I think this app could be a suitable solution for you https://apps.nextcloud.com/apps/nextbackup

Co0p3r21 avatar Dec 01 '19 11:12 Co0p3r21

No, even its dev advise using something more robust, it only backups structure, no data.

If I'd really need just db, I'd use mysqldump

mysqldump -uncadmin nextcloud > /home/pi/nextcloud.sql

Run as root or with sudo will create a backup of your db.

ovpc avatar Dec 01 '19 13:12 ovpc

If you're not using nextcloud's encryption, your files will remain readable even if the database is broken. They will even be available in NC again (after restoring the db) if you run nc-scan.

theCalcaholic avatar Dec 12 '19 10:12 theCalcaholic

Unfortunately this didn't work for me with S3. Or do I have to enter a path to nc-scan?

I also tried to just use the sql.bak file from a newer backup and insert it into an older backup but it didn't work. Restoring only the sql.bak file didn't work either.

jandamm avatar Dec 13 '19 16:12 jandamm

Hm... How exactly did you setup the S3 storage?

theCalcaholic avatar Dec 13 '19 17:12 theCalcaholic

Like this

array (                                   
    'class' => '\\OC\\Files\\ObjectStore\\S3
',                                          
    'arguments' =>                          
    array (                                 
      'bucket' => '1-nextcloud',            
      'autocreate' => true,                 
      'key' => 'KEY',      
      'secret' => 'SECRET',                           
      'hostname' => 's3.eu-central-1.wasabis
ys.com',                                    
      'port' => 443,                        
      'use_ssl' => true,                    
      'region' => 'eu-central-1',           
    ),                                      
  )

jandamm avatar Dec 13 '19 19:12 jandamm

Oh cool. I wasn't aware that NC supports this natively. I have to read through the documentation in order to judge how nc-scan works with this kind of external storage setup.

theCalcaholic avatar Dec 16 '19 09:12 theCalcaholic