391Creating a RAM Disk in OSX

OSX 10.6.2

diskutil erasevolume HFS+ "ramdisk" hdiutil attach -nomount ram://1000000

Would create a 500MB RAM Disk. The size is calculated in 512K Block, 512K * 1000000 = 500MB

Works nicely.

From here.


However, if you want to mount the RAM Disk at a specific point in your filesystem, the method above does not seem to work.

Instead try:

hdiutil attach -nomount ram://10000 Create, attach but do not mount our RAM Disk (returned /dev/disk2)

newfs_hfs -v Ramdisk /dev/disk2 Name and format the disk

mount -t hfs /dev/disk2 /your/path/ Mount the disk at a specific point. The address has to be absolute, and should point to an empty folder. Once mounted, the folder gets replaced by the RAM Disk.

umount /dev/disk2 Unmounting by ejecting the disk does not seem to work...

Sources: - - - - -