Properly backup a Minetest world with sqlite backend

Fabiowd1990
New member
 
Posts: 4
Joined: Wed Jun 20, 2018 14:57

Properly backup a Minetest world with sqlite backend

by Fabiowd1990 » Sat Mar 02, 2019 16:07

Hello guys!
I'm running a little server on a Raspberry.
Since I'd like to make a backup, I've searched on this forum and I've seen that there are several discussions about the proper way to backup a server with a SQLite backend, but it seems that no one of them shows steps in a clear way. I've edited my crontab to follow these steps:
1) pkill minetestserver ----> I'm full of doubts about the safety of this line
2) archiving the whole world
3) starting minetestserver

I'd be very grateful if someone could tell me a better way to avoid data corruption.
Thanks in advance!
 

User avatar
sorcerykid
Member
 
Posts: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: Properly backup a Minetest world with sqlite backend

by sorcerykid » Sat Mar 02, 2019 19:38

The SIGINT signal sent by the pkill command should safely kill the server process, as long as it is only sent once. The signal is caught by the main server loop which will initiate a graceful shutdown, including appropriate callbacks to mods. For all intents and purposes, it is equivalent to pressing CTRL-C in the terminal. However, the pkill and kill commands return immediately regardless of whether the process is actually terminated. So you will need to verify that the PID is actually defunct before archiving the world data.
 

User avatar
Festus1965
Member
 
Posts: 931
Joined: Sun Jan 03, 2016 11:58
Location: Thailand - Chiang Mai (+5-6h to MEZ)
In-game: Thomas Explorer

Re: Properly backup a Minetest world with sqlite backend

by Festus1965 » Sat Mar 02, 2019 22:16

Fabiowd1990 wrote:1) pkill minetestserver ----> I'm full of doubts about the safety of this line
2) archiving the whole world
3) starting minetestserver

Out of my experiance for some time, and what is needed,

it depends also of how often it is needed to update, as how much users are building ...
* did the full folder backup OFFLINE once a week, and kept then later the first of month as getting uge,
* did it with server off to be sure nothing pending
* if needed more often, just need to backup the changed files, what are in main or special folders for mods, but as the map.sql is the biggest even, just do full backup.
Last edited by Festus1965 on Sun Mar 03, 2019 23:31, edited 1 time in total.
Server: still up, see some gamer - but there is a new 1st important thread "climate change" for me. Something I know since 1992 - had seen the melting glacier in Switzerland.
 

sofar
Developer
 
Posts: 2075
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Properly backup a Minetest world with sqlite backend

by sofar » Sun Mar 03, 2019 07:01

Number one safest method is to shut down the server gracefully, and make a simple copy of your files.

A reasonably safe method that may cause your backup to "miss" changes to certain blocks in rare, unconfirmed cases is to use the sqlite ".backup" method. It is safe from corruption, but you may miss player or mod changes to a block (because you're making a live backup this way). However, no block data will ever get corrupted this way (as sqlite does not allow that). Of course you might miss last-second player changes, the benefit of this method is that you can use this method as often as you want, even every minute if you desire, without shutting your server down.

If you combine both methods, you get the best of both worlds: guaranteed good backups once every shutdown, but possibly much more good backups as your server is running.
 

Fabiowd1990
New member
 
Posts: 4
Joined: Wed Jun 20, 2018 14:57

Re: Properly backup a Minetest world with sqlite backend

by Fabiowd1990 » Tue Mar 05, 2019 20:23

sofar wrote:Number one safest method is to shut down the server gracefully, and make a simple copy of your files.
A reasonably safe method that may cause your backup to "miss" changes to certain blocks in rare, unconfirmed cases is to use the sqlite ".backup" method.


Festus1965 wrote:it depends also of how often it is needed to update, as how much users are building ...
* did the full folder backup OFFLINE once a week


sorcerykid wrote:The SIGINT signal sent by the pkill command [...] is equivalent to pressing CTRL-C in the terminal.

Thanks a lot for your replies!
I've decided to combine your advices: the method shown from sofar, since it doesn't need to kill and restart the server every time I want to backup, with the advice from Festus1965.
I'll pkill once per week to do a full backup, but I'll do live backups on a daily basis at 04:00, when I'm sure nobody is on the server.
 


Return to Servers



Who is online

Users browsing this forum: MSN [Bot] and 13 guests