Ramdisk in Debian Wheezy - a.k.a tmpfs

Use tmpfs instead of /dev/ramX in Debian Wheezy for ram based space.

I wanted to play with ram based disks in Debian 7 Wheezy and I ran into a lot on confusing articles on the topic. I turned out that the classis /dev/ramX devices are not encouraged anymore instead, there's tmpfs.

If you don't have this, create a mount point for it:

mkdir -m 1777 /ram

and mount it:

tmpfs   /ram    tmpfs   defaults,size=2g    0   0

You have a 2G space in the ram accessible right there.

Also, if you want to keep directories synced:

vim /root/sync-memdisk.sh
#!/usr/bin/env bash

DIRS=( 'subdir1' )
TARGETS=( '/target/root1' )
ORIGINS=( '/origin/root1' )

for ((i=0; i< ${#TARGETS[@]}; i++)); do

    if [ ! -d "${TARGET}/${DIR}" ]; then
        echo "Initial sync from ${ORIGIN}/${DIR} to ${TARGET}/"
        rsync -aq ${ORIGIN}/${DIR} ${TARGET}/
        echo "Sync from ${TARGET}/${DIR} to ${ORIGIN}/"
        rsync -au --delete ${TARGET}/${DIR} ${ORIGIN}/

Add it to cron:

*/2     *       *       *       *       /bin/bash /root/sync-memdisk.sh >/dev/null 2>&1