Introduction
SquashFS
In order to put a JVM in a RAM disk we are going to use the tool SquashFS.
Use the following command to install the Squash FS tools.
sudo apt-get update sudo apt-get install squashfs-tools
Make a squashfs file out of your desired JVM:
cd /usr/lib/jvm sudo mkdir ramdisk mksquashfs /usr/lib/jvm/java-8-oracle /usr/lib/jvm/ramdisk/java-1.8.0.91-oracle.sqsh
At this point you have an existing JVM squashed in .sqsh file.
Mount Point
Create a mountpoint for the ramdisk:
sudo mkdir /media/ramdisk-java-8-oracle
Edit your /etc/fstab and define your mount point as a tmpfs by adding the following declaration:
# change the default size for the ramdisk tmpfs /media/ramdisk-java-8-oracle tmpfs defaults,size=400M,mode=1777 0 0