This article provides an improved version of Mac OS X RAM disk (memory disk) creation program and practical instructions.
Concerns
Mac Thunder Download ioPS is too high, may be not using the cache, which causes the disk squeak, so worry about the disk quickly scrapped, and not at ease to download. The author has repeatedly proposed to his developers, but has not received a reply to date.
Fortunately, this machine memory space, suddenly think of the concept of memory disk.
Explore
Try the tmpdisk for a while, the effect is OK. But the attentive classmate will find: In the Activity Monitor/disk page, the process tmpdisk the amount of write data that is more than twice times the amount of data written to the actual content. For example: download at full speed at 10M speed, it is expected to write 1mib/s~1.25mib/s continuously, but Tmpdisk's continuous write has reached 3mib/s~4mib/s.
Later, referring to Eyon's article "Create RAMDisk in Mac OS x as a cache directory" [1], extracted the shell program described in method two in the article, and on the basis of continuous improvement of the following Shell utility. Share it now:
Share
1. Encode the following code
#!/bin/sh# usage: $ramdisk. SH [capacity=4] [label=ramdisk]# default capacity=4 (GB) capacity=4if ["$" = ""]; thencapacity=$1fi# default label= "RamDisk" label= "RamDisk" if ["$" = ""]; Thenlabel= "$" fi# echo "capacity= $capacity \nlabel= $label" # 1 (capacity) =2097152 (RAM) ram=$ (($capacity *2097152)) if! Test-e "/volumes/$label"; Then diskutil erasevolume hfs+ "$label" ' Hdiutil attach-nomount ram://$ram ' fi
2. Installation
Save the file to/usr/local/bin/ramdisk.sh and enable Execute permissions
$chmod 755 /usr/local/bin/ ramdisk.sh
3. Use
Default creation of 4GB, volume labeled RAMDisk memory disk
$ramdisk. Sh
Create a 8GB, volume labeled Tmpdisk memory disk
$ramdisk. SH 8 tmpdisk
4. Automation
If you need to automatically create a memory disk after the system logs in, you can implement the following steps:
A. Modify the memory disk default capacity to the appropriate number based on physical memory
B. Open System Preferences, select User and group, current user, login entry. Add the ramdisk.sh shell program that you created earlier in the list
Reference
[1]- create RamDisk as cache directory in Mac OS X
Mac OS X RAM disk (memory disk) Shell