OSX恢複FileVault2分區 FileVault 2必須有Recovery HD分區,因為它依賴於它作為系統初啟動。如果今後什麼時候或者誤操作刪除了Recovery HD分區,那麼你的機器就無法啟動鳥。 是否使用蘋果的辦法重新獲得一個Recovery HD就可以了呢?原理上說不行,因為還記得當初加密的時候的密鑰嗎?它也丟了,丟了就無法解密了。所以呢,我們需要另闢途徑來恢複它。 一般步驟: 基於一個FileVault 2是基於CoreStorage邏輯卷管理技術的事實,我們可以從CoreStorage入手。 先看看一個被加密過的磁碟回變成什麼樣子,注意其中的Unlocked行,後面會提到: [python] $ diskutil coreStorage list CoreStorage logical volume groups (1 found) | +-- Logical Volume Group 26B67367-CF79-4D1E-884C-BB96FDD79D19 ========================================================= Name: FileVault Sequence: 1 Free Space: 0 B (0 B) | +-< Physical Volume A446F211-3BCB-47F4-8EB2-7174AF4CD408 | ---------------------------------------------------- | Index: 0 | Disk: disk4s2 | Status: Online | Size: 9896046592 B (9.9 GB) | +-> Logical Volume Family 8D077574-ADC1-4979-9F1E-FF901FC20D86 ---------------------------------------------------------- Sequence: 8 Encryption Status: Unlocked Encryption Type: AES-XTS Encryption Context: Present Conversion Status: Complete Has Encrypted Extents: Yes Conversion Direction: -none- | +-> Logical Volume BD95F022-812D-366A-909C-286E5443D88E --------------------------------------------------- Disk: disk5 Status: Online Sequence: 4 Size (Total): 125505781760 B (125.5 GB) Size (Converted): 125505781760 B (125.5 GB) Revertible: Yes (unlock and decryption required) LV Name: FileVault Volume Name: FileVault Content Hint: Apple_HFS 它原來看上去是這個樣子的: [python] diskutil info disk0s2 Device Identifier: disk0s2 Device Node: /dev/disk0s2 Part of Whole: disk0 Device / Media Name: Macintosh HD Volume Name: Macintosh HD Escaped with Unicode: Macintosh%FF%FE%20%00HD Mounted: Yes Mount Point: / Escaped with Unicode: / File System Personality: Journaled HFS+ Type (Bundle): hfs Name (User Visible): Mac OS Extended (Journaled) Journal: Journal size 16384 KB at offset 0x1ab63000 Owners: Enabled Partition Type: Apple_HFS OS Can Be Installed: Yes Media Type: Generic Protocol: SATA SMART Status: Verified Volume UUID: BD95F022-812D-366A-909C-286E5443D88E Total Size: 125.5 GB (125505781760 Bytes) (exactly 245128480 512-Byte-Blocks) Volume Free Space: 62.2 GB (62152081408 Bytes) (exactly 121390784 512-Byte-Blocks) Device Block Size: 512 Bytes Read-Only Media: No Read-Only Volume: No Ejectable: No Whole: No Internal: Yes Solid State: No 其它的都不重要,重要的是他的Volume UUID,也就是 "BD95F022-812D-366A-909C-286E5443D88E",另外加密時的密鑰也不要忘了,密鑰這個樣子: 現在使用下面的命令來解密吧: [python] $ diskutil coreStorage revert <span style="font-size:18px; ">BD95F022-812D-366A-909C-286E5443D88E</span> -passphrase 2NTO-LQGA-RMXG-LFQO-B8NR-XTCT 解密之後的時這樣子的: [python] $ diskutil coreStorage list No CoreStorage logical volume groups found 鎖住的卷注意:在10.8.4之後,每個加密的FV2磁碟都會是鎖住的(Locked), 在list命令中可以看到: [python] Encryption Status: Locked 這樣在解密前需要先解鎖: [python] $ diskutil coreStorage unlockVolume BD95F022-812D-366A-909C-286E5443D88E -passphrase 2NTO-LQGA-RMXG-LFQO-B8NR-XTCT FileVaultMaster.keychain檔案?如果加密時使用的是FileVaultMaster.keychain,那麼只能使用它來解密, 首先,找到並在記憶體中開啟它: [python] security unlock-keychain /path/to/FileVaultMaster.keychain 之後使用"-recoveryKeychain /path/to/FileVaultMaster.keychain" 替換上面的 "-passphrase 2NTO-LQGA-RMXG-LFQO-B8NR-XTCT"