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.
Inspiration
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.
Feedback
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.
Is space really a concern? The point of backups is to lower the risk of losing your world. Incremental backups mean that if ANY of the incremental backups are corrupt, everything is corrupt and you're fucked. Not a great solution. If space is THAT tight, make a single daily backup and delete anything more than 3-4 backups.
How could I make this work on a server? I host with ShockByte an everytime I try to make a folder it tells me it backs up my entire directory no matter where I try to save it to? is it not possible to use this when it's not a server hosted from a PC or?
This is the best backup mod I have ever found. By the way the command I use to restore my backups are below .
Delete a backup rm -r <folderpath>
Restore a backup:
1st Rename current server folder: mv <folderpath> <folderpath_old
2nd: Copy backup folder to same same as current server folder: cp -r --preserve <BTFU_backups_folderpath>/2021-02-27_03:21/* /opt/minecraft/<serverfolderpath>
Thank you so much for this mod!! This was exactly what I was looking for. You just saved me a world of confusion!
Will this be updated for future minecraft versions?
Still wish someone made a decent port of this in 1.7.10 :) Such a great mod
In reply to Kane_Hart:
If someone wants to do the work, the code actually exists for a 1.7.10 version, but it has a severe flaw with some (including I think the latest) forge versions where it prevents world saving entirely and causes data loss. That is why it was pulled. (I actually originally developed the mod on 1.7.10, but the flaw emerged after I had moved on). So what it would take is someone with an understanding of dealing with world saving and flushing on 1.7.10, to correct my code so it doesn't cause such issues. The mod is open source and anyone wanting to publish a 1.7.10 version has my blessing, but just make sure it won't eat people's data.
In reply to capitalthree:
Yeah sadly not a coder. Was this error in your code or forge itself? So if I use a script that does the whole turn off saving then save all do a backup then enable it would I have major issues or would I be fine for that?
Hi, author, I am the owner of a small server. My server uses this mode. That would be great. It automatically backs up the server in time and saves it on the server, so that when the server goes wrong, I can restore the server faster. But I have some problems.
1. It will automatically backup faster. My server doesn't have enough storage space. It always backs up my storage space in flash, so I still play on the server, but because of the lack of storage space, it crashes.
2. I can't see a backup of it in the game.
So I would like to make the following suggestions.
Adding instructions enables us to use instructions to control its 1. Switch, 2. Backup interval, 3. Backup integrity (whole server or world folder). 4. When do you remind us to step back in the game?
Because I am the owner of a private server in China, so I have less experience in opening the server, so I can see that such a convenient style of course is a strong support for its development. But I can't speak English, so this comment was translated and produced by Baidu. There may be some confusion.
Okay, so I installed BTFU yesterday, seemed like exactly the backup program I was looking for as I was running out of space for backups. This morning my disk is completely full and the server crashed, despite the fact no one actually logged into the server and did anything. And it made a backup every 5 minutes? And I can't change that in the config file (two backups a day would be enough for me)? Am I expecting unreasonable things from this mod? Or am I doing something wrong? Also, as you mention disk space savings in your description, you might consider having it do something better when it sees disk space is low, such as shut the server down cleanly after warning the users in chat, rather than just fill up the disk until the server crashes in a bad state.
In reply to hownowbrowncouch:
Hey there, do you have an issue tracker? There's some kind of conflict between BTFU and a particular sponge plugin in use from the looks of my error log and I'd like to see if it could get sorted out
In reply to Waywardautarch :
Hello,
i'm trying to use your mod on a minecraft 1.12.2 server. The machine running it is on Windows 10 pro.
It seems there is no hardlink done; instead, the whole folder is copied every 5 minutes. Checking the size taken by the backup folder (or on the disk), using both Windows and Treesize, shows it is actually growing each time by the current total size (714 MB so far).
Do i need to install anything so that the hardlink are actually done? Or am i missing something?
Thanks for any help.
In reply to Forge_User_33687688:
In reply to capitalthree:
Thanks a lot for your detailed answer. Big respect to your precision, your searches and your will to maintain a good mod.
This is a link to the thread my make on mcbbs:http://www.mcbbs.net/forum.php?mod=viewthread&tid=817617&page=1&extra=#pid13268229
In reply to 1798643961:
In reply to capitalthree:
The only download link is your link. This page is the only download address.
Hello,I'm a Chinese player.I think your mod is very interesting.Can I share your mod to mcbbs?
An Chinese Minecraft Froum.