Mac RAM Disk

From Koset Surakomol

Jump to: navigation, search

source

Steps

Open the terminal, which you'll find in the Applications / Utilities folder. pre $ hdid -nomount ram://32768/dev/disk1 $ newfs_hfs /dev/disk1 $ mkdir /tmp/ramdisk1 $ mount -t hfs /dev/disk1 /tmp/ramdisk1 /pre

Script

pre

  1. !/bin/bash

if [ -n $2 ]; then ARG_ERR=ERR; fi if [ -z $1 ]; then ARG_ERR=ERR; fi if [ -n $ARG_ERR ]; then echo 1 argument: size in MB exit fi MB_SIZE=$1 let MB_SIZE *= 2048 echo Creating ${MB_SIZE} 512-blocks ramdisk CREATED_RAMDISK=`hdid -nomount ram://${MB_SIZE}` echo New block device: ${CREATED_RAMDISK} DISK_NAME=`basename ${CREATED_RAMDISK}` echo Creating volume with label: ${DISK_NAME} newfs_hfs -v ${DISK_NAME} /dev/r$CREATED_RAMDISK echo Mounting in /Volumes/${DISK_NAME} mkdir /Volumes/${DISK_NAME} diskutil mount ${CREATED_RAMDISK} /pre

Personal tools