- Create RAM disk
- Create JAVA squashfs
- Mount Java to RAM disk
- Set Java to default
make RAMDISK using tmpfs
:
$shell > sudo mkdir /media/ramdisk
$shell > sudo mount -t tmpfs tmpfs /media/ramdisk
Mount on Start up edit file /etc/fstab add to last line
tmpfs /media/ramdisk tmpfs defaults,mode=1777 0 0
And reboot System Compressed read-only file system for Linux.
SquashFS compresses files, inodes and directories, and supports block sizes up to 1 MB for greater compression. SquashFS is also free software (licensed under the GPL) for accessing SquashFS filesystems. SquashFS is intended for general read-only file system use and in constrained block device/memory systems (e.g. embedded systems) where low overhead is needed. The standard version of SquashFS uses gzip compression, although there is also a project that brings LZMA compression to SquashFS. Install squasfsh tools
sudo apt-get install squashfs-tools
Create .sqsh
file to be mounted later as RAM disk image.
mksquashfs /usr/lib/jvm/java-8-oracle /home/username/jdk8.sqsh
sudo mount /home/username/jdk8.sqsh /media/ramdisk -t squashfs -o loop
sudo update-alternatives --install "/usr/bin/java" "java" "/media/ramdisk/bin/java" 1
Check install java complete
sudo update-alternatives --config java # java in ram disk
Make it permanant on startup. Edit /etc/fstab add following line :
/home/username/jdk8.sqsh /media/ramdisk squashfs ro,defaults,loop 0 0
[Reference|https://prezi.com/xgwyp3reqanc/ubuntu-debian-ramdisk/]