Skip to content

Instantly share code, notes, and snippets.

@dch
Created June 14, 2016 07:58
Show Gist options
  • Save dch/e82a904ca1b2f6212da2087e21462c4d to your computer and use it in GitHub Desktop.
Save dch/e82a904ca1b2f6212da2087e21462c4d to your computer and use it in GitHub Desktop.
/r/veertu/l/v/action ╍ funced ramdisk
ramdisk> function ramdisk
             set size (math "$argv[1] * 2097152")
             diskutil eject /Volumes/ramdisk >/dev/null 2>&1
             set ramdiskpath (hdiutil attach -nomount ram://$size)
             diskutil erasevolume HFS+ 'ramdisk' "$ramdiskpath"
         end
 /r/veertu/l/v/action ╍ ramdisk 24                                                                                                   (913ms)
Unable to find disk for /dev/disk1
 /r/veertu/l/v/action ╍ diskutil list                                                                                         (1) (1s 344ms)
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *3.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS continuity              299.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4: 516E7CBA-6ECF-11D6-8FF8-00022D09712B               2.7 TB     disk0s4
/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                                                   +25.8 GB    disk1
 /r/veertu/l/v/action ╍ diskutil erasevolume HFS+ ramdisk /dev/disk1
Started erase on disk1
Unmounting disk
Erasing
Initialized /dev/rdisk1 as a 24 GB case-insensitive HFS Plus volume
Mounting disk
Finished erase on disk1 ramdisk
 /r/veertu/l/v/action ╍ mount |grep ram                                                                                              (297ms)
zroot/shared/downloads/programming on /downloads/programming (zfs, local, noatime)
/dev/disk1 on /Volumes/ramdisk (hfs, local, nodev, nosuid, noowners, mounted by dch)
 /r/veertu/l/v/action ╍
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment