Welcome to OMG boards community!
Community of friends where we talk about daily life, offtopic stuff, and what keeps us busy.

You are currently viewing our community forums as a guest user. Sign up or
Having an account grants you additional privileges, such as creating and participating in discussions.

macOS Catalina ramdisk with APFS

Discussion in 'Tech Talk' started by Floris, Dec 4, 2019 at 2:13 PM.

  1. Floris

    Floris I'm just me :) Hi. Staff Member

    Threads:
    10,444
    Messages:
    37,385
    Likes Received:
    657
    Trophy Points:
    855
    Gender:
    Male
    How to create a ramdisk on macOS Catalina with APFS instead of HFS+

    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

    Screenshot 2019-12-04 at 13.45.31.png

    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).
     
  2. OP
    Floris

    Floris I'm just me :) Hi. Staff Member

    Threads:
    10,444
    Messages:
    37,385
    Likes Received:
    657
    Trophy Points:
    855
    Gender:
    Male
    Testing gzip/tarball creation on 10gb null-file to get a sloppy impression of benefits from a temporary ram disk

    Internal drive (NVMe SSD) : 0m37.9
    Code:
    Floriss-iMac:ziptest floris$ cd Desktop/ziptest/
    Floriss-iMac:ziptest floris$ time tar czf 10000M.tar.gz 10000M
    
    real    0m37.939s
    user    0m34.177s
    sys     0m2.355s
    External drive (Sata3 SSD on USB-C) : 0m56.2
    Code:
    Floriss-iMac:ziptest floris$ cd /Volumes/SSD\ 525/ziptest
    Floriss-iMac:ziptest floris$ time tar czf 10000M.tar.gz 10000M
    
    real    0m56.197s
    user    0m18.744s
    sys        0m2.026s
    External drive (Sata3 HDD on USB-3) : 1m52.4
    Code:
    Floriss-iMac:ziptest floris$ cd /Volumes/Backup\ HDD\ 2TB/ziptest/
    Floriss-iMac:ziptest floris$ time tar czf 10000M.tar.gz 10000M
    
    real    1m52.416s
    user    0m34.692s
    sys     0m1.978s
    Ramdisk (2400 MHz DDR4 SO-DIMM, APFS) : 0m36.5
    Code:
    Floriss-iMac:ziptest floris$ cd /Volumes/ramdisk/ziptest/
    Floriss-iMac:ziptest floris$ time tar czf 10000M.tar.gz 10000M
    
    real    0m36.507s
    user    0m34.525s
    sys     0m1.738s
    The old fashioned HDD over usb-3 requires nearly two minutes to create the tarball file, and the ramdisk takes the lead with just over 35 seconds.

    Depending on the type of data you're processing, and how much the cpu/gpu is involved, tasks that can be up to 32gb and could take an hour to process, could save you more than a handful of minutes.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice