promotional bannermobile promotional banner

KBackup-Fabric

An easy-to-use backup mod for fabric Minecraft server

KBackup-Fabric is a full-featured backup mod for Fabric community. Zip backup and incremental backup are supported.

Support MC 1.14~1.18.

 

 

1. Something important

 

This plugin requires Fabric API: https://www.curseforge.com/minecraft/mc-mods/fabric-api

 

It is a simple mod for my personal server, and it works on Minecraft 1.14.x/1.15.x/1.16.x/1.17.x/1.18.x

 

All updates will be published at https://github.com/keuin/KBackup-Fabric/releases.

The latest documentation is on GitHub: README.md (Engligh) and README_zh_CN.md (Simplified Chinese).

 

Updates in Curseforge is fewer and slower than in GitHub. If you always want the latest version, please check the GitHub repo!

 

2. Commands

 

  • /kb or /kb help: show command list
  • /kb list: show existing backups
  • /kb backup [backup_name]: make a backup with given name or with the current system time by default
  • /kb incbak [backup_name]: make an incremental backup which will be saved in incremental folder. (Incremental backup will create an index file which has an ext name of .kbi, and it will be saved in backups folder, which is the same with where .zip resides)
  • /kb restore <backup_name>: restore to a certain backup. This command needs a confirmation to execute.
  • /kb confirm: confirm executing restore operation. The operation is irreversible.
  • /kb delete: delete an existing backup.
  • /kb prev: Find and select the most recent backup file. After executing this command, you can use /kb restore 1 to restore to this backup.

 

Since v1.7.0, KBackup supports permission management. You can use LuckPerms to control which command the players can use. Only OPs can backup and restore by default.

 

Permission nodes:

 

Command Permission Required
/kb kb.root
/kb help kb.help
/kb list kb.list
/kb backup kb.backup
/kb incbak kb.incbak
/kb restore kb.restore
/kb delete kb.delete
/kb confirm kb.confirm
/kb cancel kb.cancel
/kb prev kb.prev

 

3. How does KBackup work 

.zip backup mode:

 

When backing up the worlds, this plugin compresses the whole world folder into a zip file, which will be stored in the "backups" folder.

When restoring, it stop the server, then decompress the elder zip pack to recover the previous world folder. Note: This plugin does not rely on any outer script. All you need to do is to restart your server manually after it is completely shut down automatically.

 

Incremental backup mode (only save modified files in the `world` folder since last backup)

 

KBackup adopts the algorithm which git (a version control software) uses. If you are interested, google how does git work.

 

Comparision between .zip backup and incremental backup

 

Both methods have their own advantages and disadvantages.

 

.zip backup:

  • Contains everything about the world. Easy to migrate to another machine
  • Takes up more disk space than incremental backup, in a single backup
  • Backup and restoring are slower

 

Incremental backup:

  • Takes up less disk space, in a single backup
  • Very fast backup and restoration (depends on your disk speed, and especially CPU performance when making backup)
  • Harder to migrate to another machine. You have to copy the entire incremental backup storage directory, which contains all your incremental backups

 

4. Auto restart the server after resotoring from a backup

 

Due to the nature of JVM: the Java language's running environment, there is no elegant way to restart Minecraft server in a server plugin. In order to achieve auto restarting, the outer system-based script is required, i.e the script is a batch or a shell script.

KBackup exit JVM with a special code 111 after restoring the level successfully. The startup script just check the exit code and restart Minecraft server if the code is 111.

I will give examples for some popular operating systems. To use these scripts, you should replace your start.bat or start.sh script with given code lines.

 

The code formatting is rather bad, so please visit https://github.com/keuin/KBackup-Fabric/blob/master/README.md for the example script, or you can write it by yourself ;).

 

5. Compatibility with old versions of KBackup

 

  • Due to a code refactor, 1.3.0-dev and later are not compatible with earlier versions!
  • Incremental backup cannot be recognised by older versions which does not support incremental backup
  • In one sencence, unless otherwise noted, newer KBackup are always compatible with older KBackup's backup.

 

If you have any questions about this plugin, please make an issue at this project's issue page, or just leave a comment below.

 

6. How to auto backup your server

 

For those who want to backup their worlds regularly, here is an external solution (since auto-backup has not been added into KBackup):

  1. Download script from https://github.com/keuin/RconJobs
  2. Enable RCON for your server and protect it with firewall
  3. Configure authentication info for RconJobs
  4. Save the example script in `tasks` folder with an arbitrary name
  5. Run `rconjobs.py` in background when your server starts up

If you want to change the backup time or frequency, please read this manual and modify the script. You have to learn a little python.

The KBackup-Fabric Team

profile avatar
  • 1
    Followers
  • 2
    Projects
  • 3.4K
    Downloads

More from truekeuin

  • KEssential-Fabric project image

    KEssential-Fabric

    • 361
    • Mods

    An essential mod for Fabric API, providing Bukkit's Essential-like commands with vanilla taste.

    • 361
    • June 27, 2020
    • Mods
  • KEssential-Fabric project image

    KEssential-Fabric

    • 361
    • Mods

    An essential mod for Fabric API, providing Bukkit's Essential-like commands with vanilla taste.

    • 361
    • June 27, 2020
    • Mods