我试过
ramfs_size_mb=2048
mount_point=/usr/local/var/mysql
# 1024 bytes per kibibyte
# 1024 kibibytes per mebibyte
# 512 bytes per sector
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
mkdir -p ${mount_point}
到目前为止没有任何错误。
然后失败了(按照建议我可以将 /tmp 和 /var/log 放在 OS X 上的 ramdisk 中吗?):
newfs_hfs -v 'Volatile' ${ramdisk_dev}
newfs_hfs: cannot create filesystem on /dev/rdisk2 : No such file or directory
这也失败了(按照建议https://apple.stackexchange.com/questions/193883/to-have-ram-based-filesystem-in-osx):
newfs_hfs ${ramdisk_dev}
newfs_hfs: cannot create filesystem on /dev/rdisk2 : No such file or directory
我不确定 /dev/rdisk2 来自哪里,因为${ramdisk_dev} is
/dev/disk2`
echo ${ramdisk_dev}
/dev/disk2
我可以看到 RAM 磁盘:
hdiutil info
framework : 595.140.1
driver : 595.140.1
================================================
image-path : ram://4194304
shadow-path : <none>
icon-path : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type : read/write
system-image : false
blockcount : 4194304
blocksize : 512
writeable : TRUE
autodiskmount : false
removable : TRUE
image-encrypted : false
mounting user : myusername
mounting mode : <unknown>
process ID : 17797
/dev/disk2
diskutil list
.
.
.
/dev/disk2 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: +2.1 GB disk2
为什么我不能将 new_hfs 与我的 ramdisk 一起使用?