Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use a RAM disk for quicker batch processing System
I cart my 700MHz G3 iBook to work everyday because I prefer it to the provided Wintel machine. One task that I occassionally do is batch image processing with GraphicConverter. These processes -- and even image browsing -- often slow my machine to a crawl.

Out of curiosity, I decided to see if reading and writing the images with RAM Disk would save me time. Within a few minutes, I'd downloaded the freeware app Esperance DV, set up a disk image, and copied over the images to be processed from my hard drive. The increase in speed was amazing. A project that I expected would tie up my iBook for the entire day took a few hours, and I even ran it in the background while I listened to music and used Safari. Obviously, there is some risk involved when writing files to a temporary media, but if you have a slow hard drive, it may be a risk worth taking.

[robg adds: Results will be best on slower machines, obviously. I tested two small batch image processes, one on the Dual G5 and the other on my 1.33GHz G4 PowerBook. On the Dual G5, there was basically no time difference between the hard drive and the RAM disk. But on the PowerBook, the task was about three seconds quicker from the RAM disk, for a process that only took 30 seconds to begin with. Esperance DV is a nifty little free application, too -- you can have it place Safari web and icon caches on the RAM disk, as well as xCode builds.]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[20,922 views]  

Use a RAM disk for quicker batch processing | 10 comments | Create New Account
Click here to return to the 'Use a RAM disk for quicker batch processing' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use a RAM disk for quicker batch processing
Authored by: merlyn on Jan 26, '06 07:46:59AM

Looks like Esperance hates Tiger. But if you can hack a bit of command-line and a tiny bit of math, "man hdid" contains simple instructions for making a current-session ramdisk (four easy commands!).



[ # ]
Use a RAM disk for quicker batch processing
Authored by: gaoshan on Jan 26, '06 08:15:10AM

No. It works fine on my machine (10.4.4) and I've had/used Esperance DV 2.1 since about 10.4.2.
What is not working for you, specifically? There must be some other issue or conflict preventing it from functioning properly.



[ # ]
Script to make RAM Disk
Authored by: nicholfd on Jan 27, '06 05:59:36AM

Below is a script to make a 128MB RAM disk. You can easily change SizeInMB to change the size. It will appear on your desktop as "RAMDisk". The name can be changed by changing VolumeName in the script.

Copy the code below, and save it as text (I called it "mkramdisk".) Then make it executable with 'chmod 755 mkramdisk', typed in a terminal. You can execute the script with './mkramdisk', to create and mount the RAM Disk. It will be mounted in /Volumes/RAMDisk (or /Volumes/YourName, if you changed the name). When you eject the RAM Disk, log out, or reboot, the RAM Disk and its contents are removed.

Someone else may want to give instructions for making the script clickable from the GUI.......


#!/bin/bash
VolumeName="RAMDisk"
SizeInMB=128
NumSectors=$((2*1024*SizeInMB))
DeviceName=`hdid -nomount ram://$NumSectors`
echo $DeviceName
diskutil eraseVolume HFS+ RAMDisk $DeviceName


[ # ]
Script to make RAM Disk
Authored by: klatt on Jan 28, '06 12:37:00PM
If you change
SizeInMB=128
to
SizeInMB=$1
you can enter the size in MB of the RAM disk you wish to create at the command line instead of having to change the script each time. Running it to create a 300 MB disk would be:
ramdisk.sh 300
So the changed script would be:
#!/bin/bash
VolumeName="RAMDisk"
SizeInMB=$1
NumSectors=$((2*1024*SizeInMB))
DeviceName=`hdid -nomount ram://$NumSectors`
echo $DeviceName
diskutil eraseVolume HFS+ RAMDisk $DeviceName


[ # ]
Script to make RAM Disk
Authored by: chenyj on Feb 09, '06 11:20:29PM

Should consider using Gigabytes' i-RAM or Real Ram Disk's Hybrid Ram Disk at www.realramdisk.com



[ # ]
Applescript to make RamDisk
Authored by: kmmertes on Nov 18, '06 07:55:28AM

The following applescript will be runable from finder:

set VolumeName to "RAMDisk"
set SizeInMB to 512

display dialog "RAM Disk Size:" default answer SizeInMB buttons {"OK", "Cancel"} default button 1

set NumSectors to ((2 * 1024 * SizeInMB))
set DeviceName to do shell script "hdid -nomount ram://" & NumSectors
do shell script "diskutil eraseVolume HFS+ RAMDisk " & DeviceName



[ # ]
Use a RAM disk for quicker batch processing
Authored by: impdr on Nov 18, '06 11:16:18PM

For those of you, like me, who find the terminal a bit icky, I have wrapped the shell script in an Automator GUI wrapper.

This disk image contains both the Automator Action and the same exported as an app.

Cheers

Regards,
Peter



[ # ]
Use a RAM disk for quicker batch processing
Authored by: impdr on Nov 19, '06 12:00:41AM

Apologies for the link above was incorrect. Please point your browser to this page .

Regards,
Peter



[ # ]
Previous hint has additional info
Authored by: Krioni on Nov 27, '06 11:02:36AM
This was posted before: Two ways to create RAM disks. Very similar instructions.

One note - someone points out that RAM disks are largely unnecessary in Mac OS X because the OS notices which files are being used frequently and caches them to RAM itself.

Also, there is nothing (I think?) that prevents the OS from using VM (hard disk) to store the contents of the majority of your "RAM disk." Anyone know the answer to that for sure? No guessing - that's what I'm (almost) doing.

There is a detailed explanation of the pros/cons of RAM disks in Mac OS X at th OSXFAQ RAM Disk page.

---
http://www.danshockley.com

[ # ]

Use a RAM disk for quicker batch processing
Authored by: jlbrown on Jan 29, '07 08:17:40PM

The AppleScript script only seems to allow me to create a 504MB RAM disk, no matter what I enter as the desired disk size. Is this a limitation of hdid or something to do with the AppleScript?

I'd like to create the huge, 4GB RAM disk.

Thanks,

James.



[ # ]