Linux/Backups
Links: MongoDb/MongoBackupRestore
- Note: There is a lot of opensource tools for making linux backups, ranging from rsync to btrfs syncs.
- I was looking for a simple cost effective sollution that would be future proof, (Not need some special software year's later to recover.)
Backup setup
- Archive vm using tar. Builds backup file from filesystem, allows for including and excluding directories.
- Monthly Compress and stream full backup to S3 tar.xz (By streaming i don't need additional local disk space)
- Daily Compress and stream incremental change tar backup based off the initial monthly back and stream to s3.
- Setup s3 bucket to move backups older than a week to Glacier cold storage, as they will probably not be needed, and its really cheap.
Components used in backup plan
tar - https://en.wikipedia.org/wiki/Tar_(computing)
- with --listed-incremental it can keep a record of monthly full backup and then only backup changed file's for the rest of the month.
xz compression utility, tar gets piped through here. https://en.wikipedia.org/wiki/XZ_Utils
- aws s3 - to upload/stream tar to s3, reading from stdin.
Advantages of this setup
- tar is really standard way to pack files, and preserve file permisions.
- tar file can be downloaded from s3, and opend up to get hold of single file.
- by using the incremental file feature of tar, backup size is reduced, but any day can be reconstructed by just downloading 2 tar files.
- by streaming the output of tar to xv to aws s3, the backups get created while not occupying any disk space, great for small vm's on internet with limited storage, or full storage.
- all three tools are available on Linux, Windows, Mac. xz
- xz compresses the tar file, reducing the storage required in aws s3 bucket, and setting a s3 policy moving file to glacier even reduced cost further.