在Mac裡用bless找啟動磁碟

雖然筆電通常只有一顆硬碟

但寫程式為了通用性

還是會以某方式確定是哪一顆為準

在Mac底下可以用以下指令確認

/usr/sbin/bless --info --getBoot

最後會輸出

/dev/disk0s2

這就是啟動磁碟的分割區

要看相關資訊可以用 diskutil

像是

diskutil info /dev/disk0s2

會得到這個分割區的資訊

Device Identifier:        disk0s2
   Device Node:              /dev/disk0s2
   Whole:                    No
   Part of Whole:            disk0

   Volume Name:              MacOSX
   Mounted:                  Yes
   Mount Point:              /

   Partition Type:           Apple_HFS
   File System Personality:  Journaled HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended (Journaled)
   Journal:                  Journal size 16384 KB at offset 0x388000
   Owners:                   Enabled

   OS Can Be Installed:      Yes
   Recovery Disk:            disk0s3
   Media Type:               Generic
   Protocol:                 SATA
   SMART Status:             Verified
   Volume UUID:              0BE6F277-A403-3662-9CE9-166C020A8JN1
   Disk / Partition UUID:    5EA3F21E-B878-453E-938A-D7BA054PLJ71

   Disk Size:                120.5 GB (120473067520 Bytes) (exactly 235298960 512-Byte-Units)
   Device Block Size:        512 Bytes

   Volume Total Space:       120.5 GB (120473067520 Bytes) (exactly 235298960 512-Byte-Units)
   Volume Used Space:        32.2 GB (32217542656 Bytes) (exactly 62924888 512-Byte-Units) (26.7%)
   Volume Available Space:   88.3 GB (88255524864 Bytes) (exactly 172374072 512-Byte-Units) (73.3%)
   Allocation Block Size:    4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No

   Device Location:          Internal
   Removable Media:          Fixed

   Solid State:              Yes

Macbook air 的硬碟超小的….

建議大家買Mac千萬注意硬碟大小啊….

看更多