#!/usr/pkg/bin/bash root() { if [ -r /etc/shadow ]; then return 0 else return 1 fi } die() { echo "$*" >&2 exit 1 } if ! root; then echo must be root >&2; exit 1; fi if [ -z "$2" -o "$1" = "0" ]; then die Usage: $0 RAMDISK MOUNTPOINT, where RAMDISK greater than 0 fi dd if=/dev/zero of=/dev/ram$1 bs=1k count=7777 # make lots of inodes for symlinks and other small files mke2fs -v -m 0 -i 1024 /dev/ram$1 mount -t ext2 /dev/ram$1 $2