I have the following setup:
- Ubuntu 18.04 Server (older hardware, 2GB RAM), small SSD for the system
- 4TB HDD for Nextcloud data (currently about 1,2 TB used)
- 5TB external HDD (2,5 inch, USB 3) for Backup, LUKS encrypted
Before automating anything I tried to do a manual Backup (as suggested here, in german):
cd /var/www/html/nextcloud sudo -u www-data php occ maintenance:mode --on sudo tar -cpzf /mnt/NC_Backup_scripts_`date +"%Y%m%d"`.tar.gz -C /var/www/html/nextcloud . mysqldump --single-transaction -h localhost --all-databases -u username -p > /mnt/NC_Backup_DB_`date +"%Y%m%d"`.sql sudo tar -cpzf /mnt/NC_Backup_DataDir_`date +"%Y%m%d"`.tar.gz -C /media/storage/data . cd /var/www/html/nextcloud sudo -u www-data php occ maintenance:mode --off
Problem: Backing up the data dir that way would take at least 16 hours (!) for one TB.
I had the server in maintenance between midnight and 8 in the morning (about 500 GB backed up till then), but had to switch it back on so that it can be used.
So I am looking for ideas how to speed that up significantly, so that I can do a daily backup in some way.
- Shall I use an unencrypted backup drive?
- A faster backup hdd?
- Do I need a faster CPU/Server to do the compressing/encrypting in reasonable time?
- Or do I need some big Raid/LVM System where I can make snapshots etc.?
- Or do something like an rsync to a second internal hdd, and then back up that one (which can take the whole day…)?
Thanks for any ideas to get a proper setup. I am ready to buy a new machine, new hdds etc. if needed. Just would like to follow some best practice, and not reinvent the wheel.