Overclock.net banner
1 - 5 of 5 Posts

· Linux > All
Joined
·
1,744 Posts
Discussion Starter · #1 ·
I've been running my Minecraft servers on a ramdisk awhile now at my home. However I kept having issues on my laptop, the world would load real slowly. Or not even load at all. I'd be walking in mid air. I thought this was just due to my laptop being underpowered. Turns out, even with an ssd my textures were just not loading. Created a 1gb ramdisk, @reboot in the crontab to load it with the ~/.minecraft folder and create a symlink to /home/"$USER"/.minecraft and all my troubles are gone. The world loads faster than ever and I can see things from a great distance instead of waiting till I get close for them to load. I haven't had an issue since making this change.

To backup the ramdisk on shutdown / reboot I created this systemd service file.

Code:

Code:
[Unit]
Description = logs uptime
After = network.target

[Service]
User = jason
Group = jason
Type = simple
ExecStart = /bin/true
ExecStop = /home/jason/bin/mylaptop mcramdisk shutdown
RemainAfterExit = yes

[Install]
WantedBy = multi-user.target
This script both the load and shutdown

Code:

Code:
if mountpoint /ramdisk ; then
                        case "$2" in
                                shutdown)
                                        rsync -auv --progress /ramdisk/.minecraft/* /home/"$USER"/.MINECRAFT/
                                        ;;
                                load)
                                        mkdir -p /ramdisk/.minecraft
                                        rsync -auv --progress /home/"$USER"/.MINECRAFT/* /ramdisk/.minecraft/
                                        if [[ ! -e /home/"$USER"/.minecraft ]] ; then
                                                ln -s /ramdisk/.minecraft /home/"$USER"/
                                        fi
                                        ;;
                        esac
                fi
TLDR - Ramdisk loads textures instantly. Not just good for chunk loading on Minecraft. Gave my laptop whole new life with Minecraft.
 

· Registered
Joined
·
995 Posts
^ for sure, tmpfs/ramfs is a big help in any situation where a program needs to be able to read and write really fast, often that's the biggest performance bottleneck
 

· Linux > All
Joined
·
1,744 Posts
Discussion Starter · #4 ·
Refined and completed. Here is all I did to make it work. It now works for any user in a group I created (in my case, mcramdisk). This gives every user in the group full access to a 2gig ramdisk for minecraft. Automatically works when the loader and unloader scripts are set to run on startup and logout respectively in kde plasma on my laptop in each user. Resourcepacks are kept in a central folder rather than under each user and symlinked into place on login of a user.

/etc/fstab

Code:

Code:
# resource packs
none /ramdisk tmpfs defaults,gid=1014,size=2048M 0 0
mcramdiskloader script

Code:

Code:
#!/bin/bash
# tadaen sylvermane | jason gibson
# mcramdisk loader

if [[ "$USER" == root ]] ; then
        mkdir -p /ramdisk/resourcepacks
        rsync -auv --progress /data/minecraft/resourcepacks/*.zip /ramdisk/resourcepacks/
else
        mkdir -p /ramdisk/"$USER"/.minecraft
        ln -s /ramdisk/resourcepacks /ramdisk/"$USER"/.minecraft/
        rsync -auv --progress --exclude=resourcepacks /data/"$USER"/.minecraft/* /ramdisk/"$USER"/.minecraft/
        if [[ ! -h /home/"$USER"/.minecraft ]] ; then
                ln -s /ramdisk/"$USER"/.minecraft /home/"$USER"/
        fi
fi
mcramdiskunloader script

Code:

Code:
#!/bin/bash
# tadaen sylvermane | jason gibson
# mcramdisk unloader

if [[ "$USER" == root ]] ; then
        rsync -auv --progress /ramdisk/resourcepacks/* /data/minecraft/resourcepacks/
else
        rsync -auv --progress --exclude=resourcepacks /ramdisk/"$USER"/.minecraft/* /data/"$USER"/.minecraft/
        rm -r /ramdisk/"$USER"
fi
systemd service file - I had to add user and group root to this, for some reason it kept running as a regular user instead of root in my tests.

Code:

Code:
[Unit]
Description = loads minecraft ramdisk
After = network.target

[Service]
User = root
Group = root
Type = simple
ExecStart = /usr/local/bin/mcramdiskloader
ExecStop = /usr/local/bin/mcramdiskunloader
RemainAfterExit = yes

[Install]
WantedBy = multi-user.target
 

· Registered
Joined
·
1 Posts
I wonder how much RAM you had at that time to keep the servers in minecraft ? I think it should have been quite a lot
I have been playing minecraft for a long time and tried to create a server on my computer, but this was not successful for me, since at that time I did not have a powerful enough computer to do this. And I just started playing cubecraft and I still play it, lol, it really replaced my own server: D
I think that soon the personal servers will be completely out of date as there are now a lot of popular global servers that are played by a very large number of people.
 
1 - 5 of 5 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top