by Jon, Jon@smalldog.com (written by Jon, posted by Ed)
RAM disks could be easily created in the Classic MacOS, going all the way back to System 6. Many users would copy their System Folders to a RAM disk to keep the hard drive spun down and maximize battery life. A 14” Wallstreet running 8.6 off a RAM disk could run for 7 hours off two installed batteries, with screen brightness down. Things have changed since then: installation of OS X onto a RAM disk is not financially practical due to its sheer size, and there is no GUI-based method for creating a RAM disk. RAM disks were great—since RAM is so much faster than any hard drive out there, the computer could boot in 10 seconds, and things were overall incredibly snappy when running off a RAM disk.
Following a few steps in Terminal will allow you have a RAM disk again. Be careful here: incorrect syntax or typos can result in catastrophe! Your mileage may vary.
line 1 prompt$ hdid -nomount ram://52428800
According to the man page, hdid was historically a user-level process that handled the loading and decompression of disk image data for HDI disk images in the kernel. These disk images have no permissions, and the current logged-in user is the owner of the disk. If you have multiple users on your machine, and wish for the data on your RAM disk to be hidden, don’t do this.
line 2 prompt$ newfs_hfs /dev/disk1
This constructs a volume called disk1, formatted as HFS+.
line 3 prompt$ mkdir /tmp/ramdisk1
This makes a new directory called ramdisk1 on the newly created HFS+ volume
line 4 prompt$ mount
t hfs /dev/disk1 /tmp/ramdisk1
This mounts the temporary RAM disk to the desktop, as if it were removable media or a disk image. Drag stuff at will, and savor the speed! Oooh, aaaah, look how fast! Try editing huge files in photoshop with this as your scratch disk, and hang on tight: the data is fed to the processor(s) in your computer at crazy fast speeds your hard drive can only dream of.
When you’re finished, type in Terminal:
prompt$ hdiutil detach /dev/disk1
It’s important to consider that creating a RAM disk uses RAM, which means it is not available for other applications to use. Be careful in selecting the size of your RAM disk, especially on an Intel machine with integrated graphics processing-MacBooks, Minis, and the entry-level 17” iMac. More RAM is always better, and it’s extremely inexpensive right now: 1GB PC5300 chips are $59.99, and 2GB PC5300 chips are $142.99, while two months ago 1GB was $135 and 2GB chips were almost $400!