I use a 200MB Ram disk to write some throwaway files that I use repeatedly but can forget from run to run and don't mind losing on a shutdown. I often run out of space however and have to clean house.
This comes from a typical recommendation to mount a RAM disk until Macos:
can I use APFS instead? Would there be much benefit in a Ramdisk? Would it compress?
can I activate compression by default? I am dumping out a bunch of throw-away diagnostic HTML files that would take a lot less space if there was transparent file system compression like you can do on NTFS.
old-school, what about APFS? 👇 diskutil erasevolume HFS+ 'RAMDisk' `hdiutil attach -nomount ram://409600`
Diskutil itself doesn't help much:
Not one mention of APFS.
$ diskutil erasevolume -h
Usage: diskutil eraseVolume format name MountPoint|DiskIdentifier|DeviceNode Erase a single disk partition or whole, laying down a new file system volume that will be empty of files. Format is the specific file system personality name of the new volume, e.g. "Journaled HFS+" or a common alias e.g. "jhfs+". Name is the new volume name (subject to file system naming restrictions) or can be specified as %noformat% to skip initialization (to skip newfs). You cannot erase the boot volume. A pseudo-format of "free" or "Free Space" will remove the partition altogether, leaving a free space gap in the partition map. Ownership of the affected disk is required. Examples: diskutil eraseVolume JHFS+ UntitledHFS /Volumes/SomeDisk diskutil eraseVolume "Journaled HFS+" FooWholeVolEgRaid disk7 diskutil eraseVolume ms-dos FOO disk0s5 diskutil eraseVolume free free disk0s5
Not much documentation from Apple - it's terminal stuff.
Looking at man page we still only have old file systems.
Here's what using the GUI has to say:
Compressed Disk Images. what's that?
I have also seen the term compressed disk image with regards to macos. Does it have any relevance here?
giving it a try didn't help much:
Mount a 50MB
output: No clear error, but no disk either:
diskutil erasevolume APFS 'ram2'hdiutil attach -nomount ram://102400``
Started erase on disk2 Unmounting disk Erasing Mounting disk Could not mount disk2 after erase 👈 not good Finished erase on disk2
ls /Volumesdoesn't show a
total 0 drwxr-xr-x+ 4 root wheel 128 Feb 26 16:03 . drwxr-xr-x 28 root wheel 896 Sep 30 13:10 .. lrwxr-xr-x 1 root wheel 1 Feb 8 12:51 MacHD -> / drwxrwxr-x 8 jluc staff 340 Feb 14 23:01 RAMDisk 👈 existing one