Backup to second hard drive

Pardon the necrobump - but this still seems relevant to new viewers of the topic.

In contrast to the original poster’s method, I prefer to store my backups offsite. I use AWS S3 buckets as they are incredibly cheap ($0.03/GB/month) and reliable (99.99%.) My method is to daily archive my MineOS worlds via MineOS’s schedule functionality, destructively sync with the S3 bucket, then delete old archives.

It is important to schedule your backup before the sync occurs, otherwise it won’t be synced until the next scheduled cycle. It is also important to sync to S3 before automatically deleting old archives. Remember to pad enough time for the previous step to complete before starting the next cronjob. Personally, I give 30 minutes for the scheduled archive (even though it generally occurs in under a minute) and 1h45m for the S3 sync to occur. YMMV.

There’s several areas for improvement in the approach below such as triggering the deletion only after a successful upload, but it’s “good enough” :slight_smile:

Step One - Schedule Archive

Schedule daily backups/archives within MineOS’s schedule:

30 2 * * *	archive

Step Two - Sync with AWS

Destructively sync with the AWS S3 bucket by defining a cronjob (crontab -e) as the user associated with your MineOS service, which is mc by default . The example below deletes archives older than a week ("+6"). Destructively syncing removes older archives and keeps your local filesystem and S3 bucket from getting too large.

Prerequisite: awscli must be installed. On Debian/Ubuntu use apt-get install awscli

Destructively sync

0 3 * * * /usr/local/bin/aws s3 sync --delete /var/games/minecraft/archive s3://bucketname > /dev/null

Step Three - Delete Old Archives

Delete old local archives by defining a cronjob (crontab -e) as root. The example below deletes archives older than a week ("+6").

45 4 * * * find /var/games/minecraft/archive/ -type f -mtime +6 -exec rm -rf {} \;

Final Thoughts

At the moment there is no way (that I’m aware of) to delete previous archives in MineOS (@hexparrot, this functionality would be amazing! I have some free time this summer and would love to implement this as well as the Download functionality I brought up a while ago)

2 Likes