Start Minecraft server on RAM disk Linux

Create tmpfs ramdisk.  Note if your Linux user is something other than steve you’ll need to change where appropriate.

mkdir /home/steve/mcdisk

In etc/fstab add the following

tmpfs /home/steve/mcdisk tmpfs defaults,size=4096m 0 0

This creates a 4GB ram disk at /home/steve/mcdisk

To mount it you can either reboot, or run

mount -a

Copy your current Minecraft directory to the ram disk

cp -R /home/steve/Current_MC_Server/ /home/steve/mcdisk

Create a Bash script in “/home/steve” named “ramdisk_save.sh”

Paste the following in.  You may need to install rsync if you do not have it installed

!/bin/bash

RAMDISK="/home/steve/mcram/"
MCDIR="/home/steve/1.13"

rsync -r -t $RAMDISK/ $MCDIR/
rsync -r -t $MCSTORE/ $MCPATH/

Now add the script to crontab

crontab -e

and

 */5 * * * * /home/steve/ramdisk_save.sh

This will now run every 5 minutes and sync any changes on the ram disk to the original directory.

Start the Minecraft server

java -Xmx3072M -Xms3072M -jar server.jar nogui

Leave a Reply

Your email address will not be published. Required fields are marked *