BTFU continuous rsync incremental backup

6,045 Downloads Last Updated: Feb 25, 2018 Game Version: 1.12.2   +1


Incremental backups that are just snapshots of your minecraft folder!  What?  You heard me!  85% disk savings* over regular snapshot backups!

* unless you chunkload your entire world, or keep a very small amount of snapshots anyways.


How is this possible?  Hardlinks.  If you are a seasoned system administrator you already know about them.  If not, hardlinks are a way to have multiple filesystem entries for the same file without taking up extra space, and your computer that can run minecraft already supports them!

(To be specific, NTFS and every non-microsoft filesystem since forever, support hardlinks.)


BTFU takes the compromise-work out of deciding how often to back up by doing it constantly (every 5 minutes), and just being efficient.  As it goes, it prunes the backups, keeping only a specified number of them (128 by default), and the pruning is logarithmic, so that you will have more frequent backups in your recent history, but it still keeps assorted snapshots dating back to the start of your world.  You are free to delete snapshots as desired (eg to trim old history, or if you restored a prior backup) and it will let the count reach the limit again before resuming automatic pruning.  This is because even with incremental backup, taking 5 minute snapshots forever would fill your disk.





BTFU implements a time-honored UNIX backup strategy.  It uses rsync (or a jvm reimplementation) to sync your server state to a master backup copy, and then makes a hardlinked copy of that to a datestamped folder.  Hardlinks are files that point to the same underlying data on disk.  Because of this, each new backup takes up only as much space as however many files have changed since the last one.  In other words, backups of your 5GB world don't take 5GB each, unless the whole dang thing is chunkloaded.  Backups still can't be kept forever, so BTFU will prune the backups logarithmically, meaning that it will keep a higher density of more recent backups, but will always retain the original backup and a complete history of your world.  (You can also manually delete any backups you wish, and BTFU will not mind.)



Why do I need it?


Other backup mods I've found all had one of two problems: either they back up very infrequently (hourly or worse), or if they do support incremental backup, do it in some format where you have to use the mod's own tools to do any restoring.  Because of the possibility for better efficiency, many minecraft server admins already use a version of the backup scheme described above that inspired BTFU.  In fact, if you already have such scripts, including calling save-all flush before backups, then BTFU is simply another way of automating what you already have.  There's no magic here!  I simply found it very convenient to have my favorite backup scheme automated out of the box as a forge mod.


So you don't need BTFU, but if you're currently keeping infrequent backups, few backups, or no backups, BTFU is here for you with an easier way to do backup the way the linux wizards do backup.  Once you configure your backups directory, you can forget about BTFU until something goes wrong.  If it has issues taking a backup, it will print log messages.  Otherwise it will stay quiet and do its job.



Other backup advice


There are two major threats to your world.  This mod is here primarily to defend against world corruption from buggy mods or other issues.  The other threat is underlying issues with your disk or filesystem.  If you want BTFU you to defend against those, then it is up to you to ensure your BTFU backups directory is on a separate disk.  It should go without saying that backing up to a folder right next to the server folder, won't help if that hard drive dies.


The only way to get perfectly consistent backups is to fully shut down the server first.  For example, say some player deposits an item from mod-based storage into a vanilla chest right before a backup, and the mod doesn't respect the save-all command.  The resulting backup might have that item duped, because it exists in both the synced chest and the old un-synced version of the mod's storage.  These issues are not likely to be a serious issue or hose your server, but the possibility is something to be aware of.  Even if you use BTFU, it might also be good to occasionally shut down your server and take an offline backup.  Personally, I don't bother.  Up to you.





People's interest fuels my modding.  A simple comment like "hey I put this on my server, it's kinda convenient" could make the next update come sooner!  Reports of any issues you have, or any suggestions for the future, even better.


  • To post a comment, please or register a new account.
Posts Quoted: