Mac 创建磁盘镜像

最近要在mac中,下载一份Android的源码,官方文档中http://source.android.com/source/initializing.html 中指出

You can create a case-sensitive filesystem within your existing OS X environment using a disk image.
 To create the image, launch Disk Utility and select "New Image". 
A size of 25GB is the minimum to complete the build, 
larger numbers are more future-proof.
 Using sparse images saves space while allowing to grow later as the need arises.
 Be sure to select "case sensitive, journaled" as the volume format.

大致意思是说,需要创建大小写敏感的磁盘镜像,最小需要25G,于是有点疑惑,mac下的磁盘镜像 与 磁盘分区到底是个啥关系?

1.磁盘镜像与磁盘分区

磁盘映像:顾名思义,磁盘映像文件可以直接挂接到OSX中,其表现形式就像是一个磁盘分区。
磁盘映像文件类似Windows下常用的iso文件,不过mac下后缀是dmg。dmg文件双击可以直接打开,
打开后在Finder左边栏的设备中可以找到挂接好的磁盘映像。dmg文件是Mac下最常用的文件组织方式,
几乎所有的安装程序都是以dmg方式发布的。一般情况下安装程序就是打开发布文件dmg,
里面有一个app文件和应用程序文件夹,把app拖入应用程序即可。
另外我们也可以使用磁盘工具对现有硬盘进行分区,把dmg文件恢复为真正的硬盘文件。

此外,官网上也给出了创建磁盘映像的方法:如何创建受密码保护(加密)的磁盘映像

android 官网中提供了两种方式:命令行方式和图形界面方式。

图形界面方式,这里不再赘述,直接点击上面链接即可。

命令行方式:

# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmg
挂载到Volume下,
# mount the android file image
function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }


你可能感兴趣的:(硬盘,select,发布,应用程序,磁盘)