- Joined
- Jan 1, 2001
- Messages
- 60,201
How to create a ramdisk on macOS Catalina with APFS instead of HFS+
The number 2048000 is the result of 2048 times the amount of megabytes you want, in this case 2048 * 1000 (you end up with 1 gig of memory)
So to get a ramdisk of 5gb, you do 2048*5000, which will be ram://10240000
and 16gb would be 32768000
To unmount
Fair warning; a ramdisk is temporary storage (for as long as it has power). Meaning anything you put in there will be gone on a power cut, shutdown, etc. Use it as a temporary tool.
You can tell by the results from a gzip tarball creation test in the below post, that nvme and ramdisk have a significant performance/time benefit over older types of drives and external ssd, even over usb-c. If you have certain time consuming tasks it can be an option, such as cache/scratch disks for certain programs (adobe loves ram).
Code:
diskutil partitionDisk $(hdiutil attach -nomount ram://2048000) 1 GPTFormat APFS 'ramdisk' '100%'
The number 2048000 is the result of 2048 times the amount of megabytes you want, in this case 2048 * 1000 (you end up with 1 gig of memory)
So to get a ramdisk of 5gb, you do 2048*5000, which will be ram://10240000
and 16gb would be 32768000

To unmount
Code:
diskutil eject /Volumes/'ramdisk'
Fair warning; a ramdisk is temporary storage (for as long as it has power). Meaning anything you put in there will be gone on a power cut, shutdown, etc. Use it as a temporary tool.
You can tell by the results from a gzip tarball creation test in the below post, that nvme and ramdisk have a significant performance/time benefit over older types of drives and external ssd, even over usb-c. If you have certain time consuming tasks it can be an option, such as cache/scratch disks for certain programs (adobe loves ram).