Pastebin launched a little side project called, check it out ;-)Don't like ads? PRO users don't see any ads ;-)

Easily Backup Your Minecraft Server to Amazon S3

By: Jon on Feb 17th, 2012  |  syntax: None  |  size: 3.31 KB  |  hits: 144  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Here at the Diamond Mine community, we backup our server (worlds, plugins, etcetera) every day to Amazon’s Simple Storage Service (S3). If our map, or other file, were to ever become corrupt, we have a backup of that file readily available for download within seconds. S3 is extremely cheap, most of your cost will not even be for storage, but for PUT and GET requests. Not having enough disk space may be a problem for you; however, when you backup with the provided method below, files are simply transfered to your S3 bucket. Amazon S3 is a highly durable and secure method of backing up your data.
  2. In this tutorial we will be installing everything on a CentOS server – but we’ve provided commands to use if you aren’t. We will be installing s3fs, which is how we will be mounting your Amazon S3 bucket on your file system. s3fs depends on FUSE, which allows s3fs to make a drive on your file system.
  4. First off we need to install some packages that we will use for compiling s3fs and FUSE.
  5. CentOS: $ yum groupinstall 'Development Tools'
  6. Debian/Ubuntu: $ apt-get install build-essential libxml2-dev libcurl4-openssl-dev
  8. Now we will download, compile, and install FUSE:
  9. $ cd ~
  10. $ wget
  11. $ tar -xzf fuse-*.tar.gz && rm -f fuse-*.tar.gz && cd fuse-*
  12. $ ./configure --prefix=/usr/local
  13. $ make && make install
  14. $ export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
  15. $ ldconfig && modprobe fuse
  16. $ cd .. && rm -rf fuse-*
  18. Now s3fs:
  19. $ wget
  20. $ tar -xzf s3fs-*.tar.gz && rm -f s3fs-*.tar.gz && cd s3fs-*
  21. $ ./configure --prefix=/usr/local
  22. $ make && make install
  23. $ cd .. && rm -rf s3fs-*
  25. Awesome, now we have both FUSE and s3fs installed. We will now make the script to backup your server, along with the directory that s3fs will mount to. Make the directory where s3fs will mount your S3 bucket to: mkdir /mnt/minecraft. If you will be running the script used to backup the server as a non-root user, be sure to chown the folder.
  27. Go to the directory where your Minecraft server is, and make a shell file for the backup script. We will be naming this Paste the below contents into your script.
  28. #!/bin/bash
  29. echo -e "\033[32mMounting Amazon S3 bucket as drive for backup.\033[0m"
  30. s3fs S3-BUCKET-NAME /mnt/minecraft
  31. echo -e "\033[32mStarting backup.\033[0m"
  32. rsync -az --delete DIRECTORY-TO-BACKUP /mnt/minecraft
  33. echo -e "\033[32mBackup complete. Unmounting Amazon S3 drive.\033[0m"
  34. /bin/umount /mnt/minecraft
  35. echo -e "\033[32mDone.\033[0m"
  37. Be sure to replace S3-BUCKET-NAME and DIRECTORY-TO-BACKUP accordingly. Go to the Amazon Security Credentials page, and find your access key and secret access key. Create the file ~/.passwd-s3fs and enter your keys in the below format.
  38. > accessKeyId:secretAccessKey
  40. Now you must secure the credentials file, as it may not have lax permissions. You also need to chmod the shell file you just made.
  41. $ chmod 600 ~/.passwd-s3fs
  42. $ chmod +x
  44. Done! If you wish to see the script in action, simply run it by executing sh We recommend setting up a cron task to run though. It is strongly recommended that you do the first backup manually, as this may take some time for the first sync. After the first backup, only changed files will be backed up.