Mar 302014

In my post How to Create a RAM Disk – The Easy Way I released RamDiskCreator. As the name suggest it’s only duty is to create a RAM disk. The following AppleScript function does the same. I wrote it for Uwe to create two RAM disks at startup.

on createRamDisk(sizeInMB, volumeName)
	set sizeInSectors to round sizeInMB * 1024 * 1024 / 512 rounding up
	set cmd to "diskutil erasevolume HFS+ '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`"
		do shell script cmd
		return true
	on error
		return false
	end try
end createRamDisk

You can download the source here.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>