在macOS High Sierra上创建APFS RAM磁盘 [英] Create APFS RAM disk on macOS High Sierra

查看:245
本文介绍了在macOS High Sierra上创建APFS RAM磁盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常使用以下命令创建RAM磁盘

usually creating RAM disks works with the following commands

hdid -nomount ram://<blocksize>

返回例如/dev/disk2 然后,我将用

Returns e.g. /dev/disk2 Then I would format the disk, with say

newfs_hfs /dev/disk2

安装后:

mount -t hfs /dev/disk2 /some/mount/target

此过程似乎不适用于APFS.我使用的是High Sierra beta9.mount命令不会输出任何错误,但不会安装路径.

This procedure doesn't seem to work with APFS. I'm on High Sierra beta 9. The mount command doesn't output any error, but the path is not mounted.

对于我来说,hdid命令完成后,newfs_apfs -i /dev/disk2会产生

In my case, after the hdid command finished, newfs_apfs -i /dev/disk2 yields

nx_kernel_mount:1364: checkpoint search: largest xid 1, best xid 1 @ 1
nx_kernel_mount:1422: sanity checking all nx state... please be patient.
spaceman_metazone_init:278: no metazone for device 0, of size 209715200 bytes, block_size 4096
apfs_newfs:18075: FS will NOT be encrypted.

然后我输入mount -t apfs /dev/disk2 /some/target/path时,挂载命令似乎可以工作2秒钟,没有给出任何输出,并且挂载未成功.

When I then enter mount -t apfs /dev/disk2 /some/target/path then the mount commands seems to work for 2 seconds, doesn't give any output and the mount was NOT succesful.

有人可以告诉我如何实际制作APFS RAM磁盘吗?有用? :p

Can anyone tell me how to actually make a APFS RAM disk s.t. it works? :p

PS:我也尝试过类似diskutil partitionDisk /dev/disk2 GPT APFS myvolumename 0b的操作,该操作确实将卷安装到了/Volumes/myvolumename,但是创建了另一个磁盘(在这种情况下为disk3),这对我来说似乎很奇怪!

PS: I've also tried something like diskutil partitionDisk /dev/disk2 GPT APFS myvolumename 0b which does mount the volume to /Volumes/myvolumename but creates yet another disk (disk3 in this case) which seems odd to me!

推荐答案

找到了解决方案:

hdid -nomount ram://<blocksize>
diskutil erasedisk <format> <diskname> <output path of previous hdid command>

其中,<format>来自个性"列中的diskutil listFilesystems.是的,对我来说,您可能不得不引用此参数似乎也很奇怪.指定区分大小写的变体时,但是好吧...

where <format> is taken from diskutil listFilesystems from the "Personality" column. Yes, it seems weird to me too that you may have to quote this parameter, e.g. when specifying case-sensitive variants, but oh well...

<blocksize>是2048 * desired size in megabytes

最后一条命令格式化RAM磁盘并将其安装到/Volumes/<diskname>

The last command formats the RAM disk and mounts it to /Volumes/<diskname>

似乎是这样的情况,当您现在输入diskutil list时,您会看到两张新磁盘,其中一张是hdid创建的,一张是合成的.

It seems to be the case that when now entering diskutil list that you will see two new disks, the one hdid created, and a synthesized one.

要再次销毁 RAM磁盘,请调用diskutil eject <output path of previous hdid command>,例如diskutil eject /dev/disk2

To destroy the RAM disk again, call diskutil eject <output path of previous hdid command>, e.g. diskutil eject /dev/disk2

这将为您完成所有工作,卸载/Volumes/<diskname>路径并销毁两个磁盘,释放内存.

This will do all the work for you, unmounting the /Volumes/<diskname> path and destroy the two disks, releasing your memory.

请记住,<blocksize>的最小值/最大值取决于所选的<format>.同样,<diskname>不能总是任意选择.举例来说,FAT32要求它必须包含大写字母!

Keep in mind that the minimum/maximum values for <blocksize> depend on the chosen <format>. Also, <diskname> cannot always be chosen arbitrarily. Exemplary, FAT32 requires it to consist of upper-case letters!

干杯!

这篇关于在macOS High Sierra上创建APFS RAM磁盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆