[GUIDE] How to Keep Your Save Data Safe

If you're having problems with your installation of Better Than Wolves, or if you've woken up in the future and are beginning to doubt the nature of reality, here's the place to post about it.
Post Reply
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

[GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

Greetings! This guide serves as a tutorial for Minecrafters who wish to keep their precious worlds safe from the event of catastrophic failure. I know that, in my time, I have run into various situations where having a reserve copy of my world was a big help. Parts of this guide are based on Save Data Dropbox Guide, found on the Minecraft Wiki. With a few tips and tricks to make the process more automated. (Because, who doesn't love more automation?)

Prerequisites:

Dropbox (Or, you can use my referall link, which will get me extra Dropbox storage space.)
Link Shell Extension
7-zip Command-Line Version(Other archival software may work, but I will include a script that uses 7-zip command-line functions)

Dropbox:

- Install Dropbox on your PC, and create a new account if you haven't already. The free 2GB account will be more than sufficient.
- Navigate to your Minecraft installation directory (Windows: %appdata%\.minecraft, Linux: ~/.minecraft, Mac: ~/Library/Application Support/minecraft)
- Move the entire .minecraft folder into the Dropbox folder (Windows: My Documents\Dropbox, Linux: ~/Dropbox)
- As the files are moved, you will notice that the Dropbox icon in your notification area (system tray) will indicate that the files are being uploaded. That's the great thing about Dropbox, all files placed into it are automatically backed up to their servers.


Link (Windows Only):

- Install the Link Shell Extension.
- Right-click the .minecraft folder that you moved to your Dropbox folder, and select "Pick Link Source"
- Navigate back to the original installation directory that minecraft was in (EG, %appdata% on Windows)
- Right-click an empty area in the window and select "Drop As" -> "Junction". This will create a link to the .minecraft folder that you just moved to your Dropbox, so you can still play Minecraft, and all changes made to your save data will automatically be stored on Dropbox's servers

NOTE: Linux users can accomplish similar using "ln". Read the man-page to learn more. Mac OS X should also have a similar command. See the Linux spoiler section, below!

7-zip Archiving (Windows Only)

This last step is optional, but recommended, as there may be situations wherein you will want an added layer of back-up for the possibility that Dropbox becomes unavailible, or the copy of your world uploaded to Dropbox is broken as well.

- Open the 7-zip command line archive, and copy the 7za.exe file to your system path (EG: C:\WINDOWS\)
- Open Notepad (Or your prefered text-editor that can save Windows Batch files [*.bat])
- Copy the following into Notepad:

Code: Select all

@echo off

:: This script is to automatically create a zip archive of Minecraft save data.
:: Written by ReDrew89

cd "%appdata%/.minecraft/"

7za a -tzip saves.zip saves -r -mx0
exit
For Non-Windows Users: The code above can easily be adapted for GNU/Linux and Mac OSX shell scripting. Just make sure you have the '7za' package installed. Alternatively, you can use p7zip, found on the 7zip website.

- Save the file using "File -> Save As...". Make sure in the Save file dialog, you select "All Files" as the type, and name it whatever you please, just be sure to include the .bat extension.
- Now, go to Start -> All Programs -> Accessories -> System Tools -> Scheduled Tasks
(Linux users can create a cron job for the same effect. I won't go into details, because cron is pretty complex. Remember, always read the man-page)
- Create a new sceduled task, to run the script you just saved. Have it run at a time where you know your computer will be on, and Minecraft won't be running.

That's it! You will now have automatic archiving on your saves directory, which will also be uploaded to Dropbox on the fly.


Other Notes:

This is where users who have attempted these steps can point out differences between separate platforms.

General Knowledge/Tips:
Spoiler
Show
SterlingRed wrote: Sometimes a corrupted world caused by a crash or a power loss can be recovered from a recent backup without having to roll back the entire world to whatever your last backup was. Often when a world gets corrupted, replacing the level.dat file fixes the issue. Copying the level.dat from your most recent backup, will revert your player location and inventory but the contents of your world will be from whenever Minecraft last saved the chunks.

Mac OS X:
Spoiler
Show
Yamboyz1 wrote:If you have Mac OSX Lion, you're unable to access the "Library" folder in your files. The only other way to access it besides downloading a program that brings it back is to click "Go" under the menu bar then type ~/library/application support/minecraft then press enter. Or what have you.
Linux:
Spoiler
Show
chaoticneutral wrote:Updates for Linux section.

1. Installing Dropbox from the repositories will give you less headaches than from the site. For .deb (Debian, Mint, Ubuntu) distros, a simple "sudo apt-get install dropbox" without quotes in the terminal will install it and the dependencies - similar methods are avaliable for .rpm and other distros.
(Of course, you can use Synaptic or App Center if you're uncomfortable with command line.)

2. The command "dropbox" will open the CLI; it's easier to set up from the GUI (Menu > Internet > Dropbox).

3. A cronjob isn't needed for the program itself - just configure the program for your user, it'll start on itself when the desktop environment starts. Let it run, it won't annoy you.

4. I wouldn't recommend symlinks. Murphy's Law says Dropbox will try to sync while you're running Minecraft. There's a boring way to solve this (compress manually your worlds and drop the archive into Dropbox dir), and there's the Linux way - do a bash script to do the work for you. I'll show mine, adapt it to your needs:

Code: Select all

#!/bin/sh

# In order: delete oldest backup, move old to oldest, create new backup, start Minecraft
rm ~/Dropbox/mcsavegames.tbz.old
mv ~/Dropbox/mcsavegames.tbz ~/Dropbox/mcsavebackup.tbz.old
tar -cjvf ~/Dropbox/mcsavegames.tbz ~/.minecraft/saves/
minecraft
Yes, this runs Minecraft in the end - I launch the game from it to avoid forgetting run the script. Remember to set it to executable.
Windows 7 vs Earlier versions:
Spoiler
Show
Windows 7 replaces the Scheduled Tasks system originally found in Windows XP, which this guide was written using. This Microsoft article details the steps for scheduling automated tasks in Windows 7.
Last edited by redrew89 on Mon Nov 05, 2012 2:13 am, edited 6 times in total.
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
User avatar
rhacer
Posts: 295
Joined: Thu Mar 01, 2012 5:55 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by rhacer »

Nicely done. I've been worried about putting my saves on Dropbox because I didn't want to face file corruption due to network connection problems. I'm guessing I shouldn't worry about that.
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

rhacer wrote:Nicely done. I've been worried about putting my saves on Dropbox because I didn't want to face file corruption due to network connection problems. I'm guessing I shouldn't worry about that.
I've never had a problem. Then again, I always make sure I exit Dropbox when I start Minecraft, so that my hard drive doesn't bottleneck from the subsequent write-read crunch.
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by FlowerChild »

Stickied :)
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

FlowerChild wrote:Stickied :)
Thank you. :)
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
User avatar
Yamboyz1
Posts: 461
Joined: Thu Dec 01, 2011 10:20 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by Yamboyz1 »

Just so you can update the "Mac" section:

If you have Mac OSX Lion, you're unable to access the "Library" folder in your files. The only other way to access it besides downloading a program that brings it back is to click "Go" under the menu bar then type ~/library/application support/minecraft then press enter. Or what have you.
Last edited by Yamboyz1 on Thu May 10, 2012 7:39 am, edited 2 times in total.
Always bear in mind that your own resolution to succeed is more important than any other.

-Abraham Lincoln
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

Yamboyz1 wrote:Just so you can update the "Mac" section:

If you have Mac OSX Lion, you're unable to access the "Library" folder in your files. The only other way to access it besides download a program that brings it back, you have to click "Go" under the menu bar then type ~/library/application support/minecraft then press enter. Or what have you.
Good to note. I have personally never used OS X, so I couldn't really make any assumptions on how things worked. Most of the information I have in the guide regarding Mac is from the wiki guide. I'll just add this into a section in the guide for "Other Notes".
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
User avatar
Yamboyz1
Posts: 461
Joined: Thu Dec 01, 2011 10:20 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by Yamboyz1 »

I changed the wording in what I was saying so it made sense. :P
Always bear in mind that your own resolution to succeed is more important than any other.

-Abraham Lincoln
User avatar
Ribky
Posts: 965
Joined: Thu Dec 01, 2011 12:08 am
Location: CONFIDENTIAL

Re: [GUIDE] How to Keep Your Save Data Safe

Post by Ribky »

Thanks redrew, I will be backing up on (your referred) Dropbox from now on. I appreciate the tips man, this'll be better than my funky ancient flash drive by far.
The spice must flow...

[03:28] <Detritus_> Weird, I'm still logged in her
User avatar
SterlingRed
Posts: 1466
Joined: Tue Jul 05, 2011 11:02 am

Re: [GUIDE] How to Keep Your Save Data Safe

Post by SterlingRed »

It might be worth adding a bit on recovering corrupted saves due to crashes or what have you.
Sometimes a corrupted world caused by a crash or a power loss can be recovered from a recent backup without having to roll back the entire world to whatever your last backup was.
Often when a world gets corrupted, replacing the level.dat file fixes the issue. Copying the level.dat from your most recent backup, will revert your player location and inventory but the contents of your world will be from whenever Minecraft last saved the chunks
For example, my computer lost power yesterday while I was playing. This resulted in an incomplete level.dat which made the save unreadable. I replaced the file with the one from my most recent backup, three days ago, and was able to launch the save without any issues. I lost about 30 mins of work, instead of 3 days.
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

SterlingRed wrote:It might be worth adding a bit on recovering corrupted saves due to crashes or what have you.
Sometimes a corrupted world caused by a crash or a power loss can be recovered from a recent backup without having to roll back the entire world to whatever your last backup was.
Often when a world gets corrupted, replacing the level.dat file fixes the issue. Copying the level.dat from your most recent backup, will revert your player location and inventory but the contents of your world will be from whenever Minecraft last saved the chunks
For example, my computer lost power yesterday while I was playing. This resulted in an incomplete level.dat which made the save unreadable. I replaced the file with the one from my most recent backup, three days ago, and was able to launch the save without any issues. I lost about 30 mins of work, instead of 3 days.

Good tip! I was already aware of this, but I'm sure others will benefit from the information. Added to OP. :)
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
User avatar
Daedalus1312
Posts: 31
Joined: Sun Aug 05, 2012 1:30 am
Location: Madison, WI

Re: [GUIDE] How to Keep Your Save Data Safe

Post by Daedalus1312 »

This is the best thing in the world. I never even knew about hardlinks. thank you so much.
Ingame Name: Mikko_blu
User avatar
chaoticneutral
Posts: 126
Joined: Thu Aug 23, 2012 4:05 am

Re: [GUIDE] How to Keep Your Save Data Safe

Post by chaoticneutral »

Updates for Linux section.

1. Installing Dropbox from the repositories will give you less headaches than from the site. For .deb (Debian, Mint, Ubuntu) distros, a simple "sudo apt-get install dropbox" without quotes in the terminal will install it and the dependencies - similar methods are avaliable for .rpm and other distros.
(Of course, you can use Synaptic or App Center if you're uncomfortable with command line.)

2. The command "dropbox" will open the CLI; it's easier to set up from the GUI (Menu > Internet > Dropbox).

3. A cronjob isn't needed for the program itself - just configure the program for your user, it'll start on itself when the desktop environment starts. Let it run, it won't annoy you.

4. I wouldn't recommend symlinks. Murphy's Law says Dropbox will try to sync while you're running Minecraft. There's a boring way to solve this (compress manually your worlds and drop the archive into Dropbox dir), and there's the Linux way - do a bash script to do the work for you. I'll show mine, adapt it to your needs:

Code: Select all

#!/bin/sh

# In order: delete oldest backup, move old to oldest, create new backup, start Minecraft
rm ~/Dropbox/mcsavegames.tbz.old
mv ~/Dropbox/mcsavegames.tbz ~/Dropbox/mcsavebackup.tbz.old
tar -cjvf ~/Dropbox/mcsavegames.tbz ~/.minecraft/saves/
minecraft
Yes, this runs Minecraft in the end - I launch the game from it to avoid forgetting run the script. Remember to set it to executable.
--Who do you think you are, War?
User avatar
redrew89
Posts: 388
Joined: Mon Jul 04, 2011 11:38 pm

Re: [GUIDE] How to Keep Your Save Data Safe

Post by redrew89 »

chaoticneutral wrote:Updates for Linux section.

[...]
Good stuff! I'll definitely update the OP with this information!
FlowerChild wrote:Happiness is a warm and moist tentacle.
FlowerChild wrote:I just want to be loved.
Havok wrote: I'm so fucking psyched I could punch a kitten into the troposphere
Post Reply