Skip to content

Entries tagged "memory".

Load a directory in RAM

A nifty little bash script that loads stuff in memory so it runs super fast!
# This script remounts a directory in tmpfs (ramdisk) to speed it up


if [ ! "$UID" = "0" ]; then
    # this script must run by root. Let's try sudo'ing to root..
    exec sudo $0 $*

if [ ! -d $DIR ]; then
    echo "Usage: $0 "
    exit 1

if [ "a$SIZE" = "a" ]; then
    OPTIONS="-o size=$SIZE"

# first, copy everything somewhere to reuse it later
tar cpf $TMP $DIR

# remount dir as ramdisk
mount -t tmpfs $OPTIONS $DIR $DIR

# unpack everything back
(cd / && tar xpf $TMP)
rm -f $TMP
Cheers Evgueni!

Installing a 64bit kernel into a 32bit CentOS OS

Today I needed to make a CentOS 6 32bit OS see 24 GB RAM. Unfortunately, although the default 32bit kernel from RH already has PAE enabled, it will not handle more than 16 GB RAM, the only solution that came to mind was to use a 64bit kernel.
This is possible, but does not seem like a very good or elegant solution, at least not for long term; however it's WAY quicker than a full reinstall.
All one needs to do is get the 64 bit kernel from a mirror and install it via rpm:
rpm -ivh --force --ignorearch kernel-2.6.32-431.el6.x86_64.rpm
That's it, now edit /boot/grub/menu.lst to make it default and off you go: reboot!