0

I have a VPS with Wordpress (including storage and database on the same machine).

Now I want to make daily backups to an external service (AWS S3): the issue is that first I need to generate a tar of the storage and a dump of the database, and those are temporary stored on the local filesystem. Basically half of disk space should be kept free in order to being always able to perform this important operation.

Basically the backup should never fail due to shortage of free disk space.

How can I achieve that?

How can I reserve space (some GBs) for a folder (e.g. backup folder)?

Or, alternatively, can I reserve some space to a user (e.g. backupdaemon user)?

Other solutions?

1

2 Answers 2

0

First you need to calculate how much space you require to tar and gzip the require files and db

You can do one task at a time example: First take backup of storage tar/gzip transfer it to AWS S3 and then delete the backup file from disk doing this will need less space, once your done with storage backup then you can do the same process with db backup

Also if possible you can extend your drive or add additional drive for backups, you can write a script which will do all this tasks and add it to cron you can also add alerts on email so that you can get updates of successful and failed backups, also you can use monitoring tools like nagios which can send you alerts for disk space on server

Also if your doing daily backups to AWS S3 then i would recommend to set life cycle for your s3 bucket so that after certain period you data is moved to AWS Glacier this will save some $

0

Without knowing your VPS provider, it is hard to know if this would be allowed. One 'simple' method would be to just create a separate filesystem. IE you have /var/backup_tmp or something with sufficient space on that filesystem for your backups.

Another method, assuming your software doesn't run as root. Configure filesystem quotes so that your software won't be able to use more then some defined amount of storage.

Whatever solution you go with, consider installing something like monit on the VPS, and configure it to send alerts when your run out of storage. Also make sure your backup software notifies you when it fails.

Of course possibly even better. Use a backup tool like borg that doesn't actually require the intermediate storage. Not sure if it can backup to S3, but there are cloud based providers that you can use borg with. 1 [2]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .