如何通过SuperDuper恢复后为新SSD创建恢复分区


0

我最近在我的旧MacBook Pro上安装了一个新的SSD - 取代了硬盘。它正在运行El Capitan。安装新驱动器后,我从SuperDuper克隆启动,将新的内部SSD格式化为Mac OS X Journaled,并使用SuperDuper将文件从备份恢复到新SSD。

但是 - 我刚刚意识到新的SSD没有恢复分区。有没有办法创建一个恢复分区而不需要完整的OS X El Capitan重新安装?


顺便说一下,我知道过去有过这方面的一些问题(例如 apple.stackexchange.com/questions/19145/... )但它们似乎适用于旧版本的OS X.
Jason

我刚刚使用磁盘工具来克隆可启动的El Capitan分区。磁盘工具还会自动克隆恢复分区。我克隆到同一个驱动器,但我认为如果使用不同的驱动器,这将工作。另外,我没有使用Core Storage。
David Anderson

@David我刚刚使用'diskutil list'检查过,并且没有自动创建恢复分区...
Jason

其实, diskutil list 会给你错误的输出。在运行命令之前,您需要重新启动计算机。只是为了通知您,我使用“磁盘工具”应用程序进行测试,将HFS +格式化分区(48465300-0000-11AA-AA11-00306543ECAC)复制(克隆)到新驱动器。以下恢复分区(426F6F74-0000-11AA-AA11-00306543ECAC)也会自动复制。
David Anderson

Answers:


1

如果仍有Recovery分区,则可以手动传输分区。

下面给出的示例是使用两个稀疏磁盘映像和Yosemite(OS X 10.10.5)生成的。你可能不得不跳过我没必要的箍。其中一些是:

  • El Capitan和更高版本的用户可能需要禁用系统完整性 保护(SIP)。
  • 要输入某些命令,您可能需要从USB设备启动 (闪存驱动器,HDD或SSD)或使用Internet恢复。
  • 添加或删除命令前缀 sudo
  • 使用 cd 命令导航到正确的目录(文件夹)。
  • 在具有正确路径的命令或文件之前。
  • 如果扇区大小不是512字节,请进行适当调整。
  • 如果使用Core Storage,则应对额外的复杂性。

以下是从中复制恢复分区的过程 /dev/disk1/dev/disk2。此过程需要使用名为的第三个奇偶校验命令 gdisk。有关此命令的更多信息,请访问该站点 “GPT fdisk教程”

最初包含的 /dev/disk1/dev/disk2 如下。

Steelhead:recover davidanderson$ sudo gpt -r show /dev/disk1
Password:
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  197892752      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  198302392    1697608      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  200000000          7         
  200000007         32         Sec GPT table
  200000039          1         Sec GPT header
Steelhead:recover davidanderson$ sudo gpt -r show /dev/disk2
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640   99328216      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
   99737856     262151         
  100000007         32         Sec GPT table
  100000039          1         Sec GPT header
  1. 映像整个源分区。这个分区非常小 通常没有安装。只需将分区复制到文件即可。

    Steelhead:recover davidanderson$ sudo dd if=/dev/disk1s3 of=recovery.binary bs=40960
    21220+1 records in
    21220+1 records out
    869175296 bytes transferred in 44.563133 secs (19504358 bytes/sec)
    Steelhead:recover davidanderson$ ls -l
    total 1697608
    -rw-r--r--  1 root  staff  869175296 Jul 20 11:53 recovery.binary
    
  2. 为新的恢复分区腾出空间。

    Steelhead:recover davidanderson$ diskutil resizevolume /dev/disk2s2 limits
    For device disk2s2 MacintoshHD:
            Current size:  50.9 GB (50856046592 Bytes)
            Minimum size:  5.5 GB (5524418560 Bytes)
            Maximum size:  50.9 GB (50856046592 Bytes)
    Steelhead:recover davidanderson$ diskutil resizevolume /dev/disk2s2 45G
    Started partitioning on disk2s2 MacintoshHD
    Verifying the disk
    Verifying file system
    Checking Journaled HFS Plus volume
    Checking extents overflow file
    Checking catalog file
    Checking multi-linked files
    Checking catalog hierarchy
    Checking extended attributes file
    Checking volume bitmap
    Checking volume information
    The volume MacintoshHD appears to be OK
    File system check exit code is 0
    Resizing
    Finished partitioning on disk2s2 MacintoshHD
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *51.2 GB    disk2
       1:                        EFI EFI                     209.7 MB   disk2s1
       2:                  Apple_HFS MacintoshHD             45.0 GB    disk2s2
    
  3. 在上创建新的恢复分区 /dev/disk2 新的 分区必须与现有的Recover完全相同 划分。

    Steelhead:recover davidanderson$ sudo gdisk /dev/disk2
    Password:
    GPT fdisk (gdisk) version 1.0.1
    
    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Partition table scan:
      MBR: protective
      BSD: not present
      APM: not present
      GPT: present
    
    Found valid GPT with protective MBR; using GPT.
    
    Command (? for help): n
    Partition number (3-128, default 3): 
    First sector (34-100000006, default = 88300264) or {+-}size{KMGTP}: 
    Last sector (88300264-100000006, default = 100000006) or {+-}size{KMGTP}: +1697608
    Current type is 'Apple HFS/HFS+'
    Hex code or GUID (L to show codes, Enter = AF00): AB00
    Changed type of partition to 'Recovery HD'
    
    Command (? for help): x
    
    Expert command (? for help): a
    Partition number (1-3): 3
    Known attributes are:
    0: system partition
    1: hide from EFI
    2: legacy BIOS bootable
    60: read-only
    62: hidden
    63: do not automount
    
    Attribute value is 0000000000000000. Set fields are:
      No fields set
    
    Toggle which attribute field (0-63, 64 or <Enter> to exit): 49
    Have enabled the 'Undefined bit #49' attribute.
    Attribute value is 0002000000000000. Set fields are:
    49 (Undefined bit #49)
    
    Toggle which attribute field (0-63, 64 or <Enter> to exit): 
    
    Expert command (? for help): w
    
    Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
    PARTITIONS!!
    
    Do you want to proceed? (Y/N): y
    OK; writing new GUID partition table (GPT) to /dev/disk2.
    Warning: Devices opened with shared lock will not have their
    partition table automatically reloaded!
    Warning: The kernel may continue to use old or deleted partitions.
    You should reboot or remove the drive.
    The operation has completed successfully.
    Steelhead:recover davidanderson$ sudo gpt -r show /dev/disk2
          start       size  index  contents
              0          1         PMBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6         
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640   87890624      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
       88300264    1697608      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
       89997872   10002135         
      100000007         32         Sec GPT table
      100000039          1         Sec GPT header
    
  4. 弹出并重新连接 /dev/disk2。如果你不能这样做的话 重启Mac。

    Steelhead:recover davidanderson$ diskutil eject /dev/disk2
    Disk /dev/disk2 ejected
    
  5. 将保存的图像复制到新的恢复分区。因为这是一个 精确复制,使用 hfs.util 命令生成新的UUID密钥 对于HFS文件系统。

    当使用El Capitan(OS X 10.11)时,完整的路径 hfs.util 命令是 System/Library/Filesystems/hfs.fs/Contents/Resources/hfs.util

    Steelhead:recover davidanderson$ sudo dd if=recovery.binary of=/dev/disk2s3 bs=40960
    Password:
    21220+1 records in
    21220+1 records out
    869175296 bytes transferred in 52.127608 secs (16673992 bytes/sec)
    Steelhead:recover davidanderson$ /System/Library/Filesystems/hfs.fs/hfs.util -k disk2s3; echo
    78A8438E-2299-3AF0-AD9E-3AC225B0554A
    Steelhead:recover davidanderson$ /System/Library/Filesystems/hfs.fs/hfs.util -s disk2s3
    Steelhead:recover davidanderson$ /System/Library/Filesystems/hfs.fs/hfs.util -k disk2s3; echo
    0F4F5893-D9E1-3512-9B2B-2AEA0DE9FDE3
    
  6. 弹出并重新连接 /dev/disk2。如果你不能这样做的话 重启Mac。

    Steelhead:recover davidanderson$ diskutil eject /dev/disk2
    Disk /dev/disk2 ejected
    
  7. 尝试恢复任何剩余的可用空间。

    下面是第一次尝试。该 diskutil resizevolume /dev/disk2s2 R 命令失败。

    另请注意 diskutil resizevolume /dev/disk2s2 limits 命令 报告错误的最大尺寸。

    Steelhead:recover davidanderson$ diskutil resizevolume /dev/disk2s2 R
    Started partitioning on disk2s2 MacintoshHD
    Verifying the disk
    Verifying file system
    Checking Journaled HFS Plus volume
    Checking extents overflow file
    Checking catalog file
    Checking multi-linked files
    Checking catalog hierarchy
    Checking extended attributes file
    Checking volume bitmap
    Checking volume information
    The volume MacintoshHD appears to be OK
    File system check exit code is 0
    Resizing
    Error: -69742: The requested size change for the target disk or a related disk is too small;
    please try a different disk or partition, or make a larger change
    Steelhead:recover davidanderson$ diskutil resizevolume /dev/disk2s2 limits
    For device disk2s2 MacintoshHD:
            Current size:  45.0 GB (44999999488 Bytes)
            Minimum size:  5.5 GB (5524459520 Bytes)
            Maximum size:  45.0 GB (44999999488 Bytes)
    

    再试一次,但这次计算分区的大小 /dev/disk2s2 应该。

    Steelhead:recover davidanderson$ sudo gpt -r show /dev/disk2
    Password:
          start       size  index  contents
              0          1         PMBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6         
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640   87890624      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
       88300264    1697608      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
       89997872   10002135         
      100000007         32         Sec GPT table
      100000039          1         Sec GPT header
    Steelhead:recover davidanderson$ expr 10002135 \* 512 / 100000000 + 450 
    501
    Steelhead:recover davidanderson$ diskutil resizevolume /dev/disk2s2 50.1G
    Started partitioning on disk2s2 MacintoshHD
    Verifying the disk
    Verifying file system
    Checking Journaled HFS Plus volume
    Checking extents overflow file
    Checking catalog file
    Checking multi-linked files
    Checking catalog hierarchy
    Checking extended attributes file
    Checking volume bitmap
    Checking volume information
    The volume MacintoshHD appears to be OK
    File system check exit code is 0
    Resizing
    Waiting for the disks to reappear
    Finished partitioning on disk2s2 MacintoshHD
    /dev/disk2
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *51.2 GB    disk2
       1:                        EFI EFI                     209.7 MB   disk2s1
       2:                  Apple_HFS MacintoshHD             50.1 GB    disk2s2
       3:                 Apple_Boot recovery                869.2 MB   disk2s3
    Steelhead:recover davidanderson$ sudo gpt -r show /dev/disk2
    Password:
          start       size  index  contents
              0          1         PMBR
              1          1         Pri GPT header
              2         32         Pri GPT table
             34          6         
             40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
         409640   97851560      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
       98261200    1697608      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
       99958808      41199         
      100000007         32         Sec GPT table
      100000039          1         Sec GPT header
    

    这次尝试成功了。在实践中,你永远无法恢复所有的免费 空间。请注意新的Recovery分区 /dev/disk2s3 是 自动重新定位。


大卫,谢谢你的详细解答。最后,我发现(参见我自己的答案),最简单的解决方案就是重新安装OS X,这是简单且非破坏性的。
Jason

0

我发现只需重新安装OS X就可以了。这真的很简单,甚至没那么久。刚刚在App Store搜索了El Capitan安装程序,它安装在当前安装上 - 特别是没有删除或弄乱主文件夹中保存的任何用户文件。这重新创建了恢复分区,并确保所有驱动程序等都已正确安装。到目前为止工作得很好,并没有处理神秘的终端命令,虽然我可以处理它,但我会担心恢复分区在我需要它时无法正常工作。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.