RAM Disk under OS X

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!

Similar Posts

  • Nifty Aperture Plug-in

    I’ve just started using Aperture, it’s definitely a step up from iPhoto but all the new features make it worth it. Today I…

  • Creating an Encrypted Disk Image

    When I travel with a computer, I am very careful about making sure important data is hidden away, and in some cases even…

  • De-authorize your iTunes Account Before Hardware Repair or Sale

    Pretty much everyone has downloaded media from the iTunes store, but not too many of us know just how iTunes keeps track of computer authorization. Every device on the internet has at least two unique identifiers: a MAC address and an IP address.

    MAC is an acronym for Media Access Control. Many believe that Mac, the abbreviation for Macintosh, should be written with capital letters – this is incorrect. Likewise, iPod – not iPOD or IPOD; iMac – not iMAC or IMAC; etc. Network interfaces have MAC addresses; Macintoshes can be called Macs.

    Since your MAC address is completely unique, it’s the ideal way for iTunes to know that you’re authorized to play purchased content on any given machines. Trouble is, your ethernet port is part of the main logic board, which requires replacement in some repairs. With a new main logic board comes a new MAC address, which confuses iTunes and some other, generally high-end, software.

    You’re allowed to authorize up to five computers at any one time to play your purchased content, but replacing your logic board changes the MAC address. If you didn’t de-authorize before repair, you’ve lost 20% of your available authorizations. I made this mistake a few years ago when I had to replace the logic board in a Mac Mini hooked up to my television, and when I sold my iBook. I also lost an authorization when my two-week-old PowerBook G4 flew off the roof of my car at highway speed. Thankfully, iTunes allows you to de-authorize all computers on your account once annually.

    I only have one Machine these days, a 17-inch MacBook Pro, so this hasn’t been a problem of late for me. It’s a common question asked our technical support team, and a good fix to file in your troubleshooting arsenal.

    The full details from Apple can be found here: http://support.apple.com/kb/HT1420

  • Mac Menu Symbols

    You can get more from your Mac, and use if more efficiently, if you utilize its built in keyboard shortcuts. You can see…