MinecraftServerControl / mscs

Powerful command-line control for UNIX and Linux powered Minecraft servers
https://minecraftservercontrol.github.io
BSD 2-Clause "Simplified" License
479 stars 61 forks source link

critial data loss bug, all backups purged by restore command, because they were older than 15 days #322

Closed heathfx closed 1 year ago

heathfx commented 1 year ago

this is a critical data loss issue because of a very bad behavior of the backup-restore command. I just attempted to revive a server that failed 6 months ago...which means 6 month old backups.

when I ran "mscs restore-backup my-server the-last-backup-date", it thought it would be wise to purge everything older than 15 days which is everything....SMH.

...AND purge everything before even restoring a single piece of data.

backup pruning should NEVER EVER be performed as part of a restore command! AGAIN a backup restore command should NEVER NEVER NEVER EVER delete data from the backup storage!!

luckily I didn't try to restore directly from my backup disk, but this could have nuked everything i had... built by a community of 180 players that needed a place to call home during the pandemic.

zanix commented 1 year ago

Confirmed, restore-backup runs a backup before performing a restore. https://github.com/MinecraftServerControl/mscs/blob/main/msctl#L3294

And the backup process runs a prune after the backup. Either worldBackup needs an argument to not prune or worldBackup should be removed from restore-backup

sandain commented 1 year ago

We should get this fixed. I'll have to take a closer look at this, but I think the worldBackup function should not be running the prune. It should be done in a separate function that can be called as necessary to retain the original intended functionality.

sandain commented 1 year ago

This should now be fixed with PR #326.