Page 1 of 1

Do we have map recovery/repair tool?

PostPosted: Thu Sep 17, 2015 05:47
by linushsao
it happen at last night,becuase of my old nb's(used to be my server) hard driver's problem(sector error or other).when i try to restart my world,i got error message and minetestserver stop.i guess my world map data has beed saved to the error sector of hd.

do we have any recovery/repair tool could rescue my map?

Re: Do we have map recovery/repair tool?

PostPosted: Thu Sep 17, 2015 08:46
by TenPlus1
This will hopefully recover your map so long as you are using linux with python installed...

Unpack both files into your .minetest folder contained in your home directory and edit the "recovery.py" file and change lines 25 and 26 so they point to your map files...

Finally open a terminal window and change to your .minetest folder and run this command (make sure recover.py has executable flag set):

./recover.py

...now just wait, anything salvagable will be written into new mapfile, anything corrupt will be marked as an empty block... good luck...

Re: Do we have map recovery/repair tool?

PostPosted: Thu Sep 17, 2015 13:53
by linushsao
TenPlus1 wrote:This will hopefully recover your map so long as you are using linux with python installed...

Unpack both files into your .minetest folder contained in your home directory and edit the "recovery.py" file and change lines 25 and 26 so they point to your map files...

Finally open a terminal window and change to your .minetest folder and run this command (make sure recover.py has executable flag set):

./recover.py

...now just wait, anything salvagable will be written into new mapfile, anything corrupt will be marked as an empty block... good luck...


Tks TenPlus1,Tks for you help.

i had try but got error msg:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
File "./recover.py", line 41
    print "Block parse error:", pos[0], pos[1], pos[2]
                             ^
SyntaxError: Missing parentheses in call to 'print'


my setting of line 25/26:
source = r'/home/linus/.minetest/worlds/stable/map.sqlite'
target = r'/home/linus/.minetest/worlds/stable/newmap.sqlite'

do i have anything wrong?

Re: Do we have map recovery/repair tool?

PostPosted: Thu Sep 17, 2015 14:04
by linushsao
solved, i replace line 41 with:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
print("Block parse error:", pos[0], pos[1], pos[2])

Re: Do we have map recovery/repair tool?

PostPosted: Thu Sep 17, 2015 14:19
by linushsao
i got confused, after run recovery.py , i got many error,the output file "newmap.sqlite" got 3.0kb . i try another correct map,i got many error,too.

Re: Do we have map recovery/repair tool?

PostPosted: Fri Sep 18, 2015 00:35
by Exilyth
I've got an idea for a map restore tool: saving a world in a working directory of a git repository and performing a commit whenever the server shuts down (or in regular intervals) might work. This would enable restoring the world to a certain commited state, but would require being setup just after the world is generated.

Ofc, regularly copying the world to a backup folder would be easier and would work too.

This is not very helpfull for the problem at hand though, sorry.

Re: Do we have map recovery/repair tool?

PostPosted: Fri Sep 18, 2015 01:19
by linushsao
Exilyth wrote:I've got an idea for a map restore tool: saving a world in a working directory of a git repository and performing a commit whenever the server shuts down (or in regular intervals) might work. This would enable restoring the world to a certain commited state, but would require being setup just after the world is generated.

Ofc, regularly copying the world to a backup folder would be easier and would work too.

This is not very helpfull for the problem at hand though, sorry.


actually i had think about this idea for a while,using subversion.maybe it can be done also by simply a daily backup script for the worlds folder.but i also thought that maybe hd will not go wrong so fast...>_<. now i'm using my backup half mounth before.

it will be great if we could have this tools bundled into minetest in furture.

Re: Do we have map recovery/repair tool?

PostPosted: Thu Feb 23, 2017 22:12
by hajo
linushsao wrote:
TenPlus1 wrote:This will hopefully recover your map
so long as you are using linux with python installed ... ./recover.py

i had try but got error msg: ...

So, has this tool been fixed, and successfully used on any minetest-server ?

Re: Do we have map recovery/repair tool?

PostPosted: Fri Feb 24, 2017 00:13
by rnd
Tried both 1. recover.py method and 2. SQLite shell method. 2nd method restored some blocks 1st method didnt:

1. download http://www.sqlite.org/2017/sqlite-tools ... 170000.zip (if you have linux http://www.sqlite.org/2017/sqlite-tools ... 170000.zip)

2. unzip near your bad map.sqlite and run "sqlite3 map.sqlite"
a. inside bash shell write:
<bash>.mode insert
<bash>.output newdata
then exit bash (ctrl+c) when finished
3. run "sqlite3 newmap.sqlite"
a. inside bash shell write
<bash>.read newdata
and exit when finished

this produces error-free newmap.sqlite. You can delete temporary file "newdata". This method seems to be faster than python script.

However it was still not usable to satisfactory restore corrupted map on my server - too many missing chunks - seems all the ones where some recent activity happened. Water represents missing areas that were corrupted beyond repair

Image