Child pages
  • Ramdisk Java
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

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 with a roughly size of 176M:

user@machine:/media$ ls --block-size=M -al /usr/lib/jvm/ramdisk/java-1.8.0.91-oracle.sqsh 
-rw-r--r-- 1 user users 176M May 12 15:53 /usr/lib/jvm/ramdisk/java-1.8.0.91-oracle.sqsh

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 declarations:

# change the default size for the ramdisk
tmpfs /media/ramdisk-java-8-oracle tmpfs defaults,size=350M,mode=1777 0 0
/usr/lib/jvm/ramdisk/java-1.8.0.91-oracle.sqsh /media/ramdisk-java-8-oracle squashfs ro,defaults,loop 0 0

If you reboot at this point you will have a ramdisk of 350M defined at /media/ramdisk-java-8-oracle filled with your squashed JVM:

user@machine:/media$ du -hs ramdisk-java-8-oracle/
349M ramdisk-java-8-oracle/

That way we know how correctly size what we need for our ramdisk.

350M for a java-1.8.0.91 from Oracle.

Installation

At this point you need to reboot to initialize the ramdisk with your Squashed JVM.

Now we need to 


  • No labels