如何调整 APFS 卷的大小以回收其容器内的所有空间?

Jon*_*ter 5 mac mac-pro macos apfs macos-mojave

我正在 MacOS 10.14.6 上运行 MacPro 5,1,并使用 500GB 三星 SSD 作为启动/主机驱动器。我最近用完了 500GB 固态硬盘的空间,所以我指定了一个相同的 1TB 固态硬盘。

干净的重新安装对我来说不是一个选择,所以我使用clonezilla将块复制到新驱动器(使用newb设置,所有默认值)。复制完成并从新的 1tb 驱动器启动后,“磁盘工具”显示了完整的 1tb 物理磁盘,但 APFS 容器和卷的大小仍然为 500GB,完全否定了我的升级 =(

这就是奇怪的地方。几个月前我对此进行了愚弄,所以我不记得我做了什么,也不记得在哪里找到了这方面的文档,但不知何故,我设法将容器大小调整为 1tb,但 APFS 卷大小从未改变,因为我仍然500GB 可用磁盘空间不足。如果有帮助的话,我觉得我隐约记得使用 GParted 的函数来完成此操作,但我不记得除此之外的任何内容。

我该如何解决?对于上下文,我的启动驱动器是 disk2,APFS 容器的物理存储位于 disk2s2。我尝试希望resizeContainer disk2s2 0它能以某种方式意识到不匹配并修复 APFS 卷大小,但没有成功。我还尝试过resizeContainer disk2s2 500g将容器缩小到 500GB,然后resizeContainer disk2s2 0再次重试并正确回收驱动器上未使用的 500GB。diskutil list我将显示这两个的输出以及diskutil apfs list(缩写,我有很多其他驱动器哈哈),以及我在磁盘工具中看到的内容。

非常感谢任何见解,因为我在这里无法理解。谢谢!

$ diskutil list
/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                 Apple_APFS Container disk3         1000.0 GB  disk2s2

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +499.9 GB   disk3
                                 Physical Store disk2s2
   1:                APFS Volume JBax Mac Pro            484.6 GB   disk3s1
   2:                APFS Volume Preboot                 44.5 MB    disk3s2
   3:                APFS Volume Recovery                1.0 GB     disk3s3
   4:                APFS Volume VM                      3.2 GB     disk3s4

$ diskutil apfs list
APFS Container (1 found)
|
+-- Container disk3 C2500AD1-3713-42B3-847F-663C77A85C86
    ====================================================
    APFS Container Reference:     disk3
    Size (Capacity Ceiling):      499898105856 B (499.9 GB)
    Capacity In Use By Volumes:   489041268736 B (489.0 GB) (97.8% used)
    Capacity Not Allocated:       10856837120 B (10.9 GB) (2.2% free)
    |
    +-< Physical Store disk2s2 D63FD546-5CC2-4EB7-B5E7-8DA660BA026B
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk2s2
    |   Size:                       999995133440 B (1000.0 GB)
    |
    +-> Volume disk3s1 66E7E184-D546-4493-854D-92632DF1A94D
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk3s1 (No specific role)
    |   Name:                      JBax Mac Pro (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         484590370816 B (484.6 GB)
    |   FileVault:                 No
    |
    +-> Volume disk3s2 42F434F9-B33D-423F-99C1-F7B04B2EE0C1
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk3s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         44486656 B (44.5 MB)
    |   FileVault:                 No
    |
    +-> Volume disk3s3 26827351-189E-4ECB-983F-738A825FAD80
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk3s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               /Volumes/Recovery 1
    |   Capacity Consumed:         1023565824 B (1.0 GB)
    |   FileVault:                 No
    |
    +-> Volume disk3s4 C571DD11-615E-43CF-BFC0-7FBEC0321EA7
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk3s4 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               /private/var/vm
        Capacity Consumed:         3221385216 B (3.2 GB)
        FileVault:                 No
Run Code Online (Sandbox Code Playgroud)

磁盘实用程序的屏幕截图: 1. 磁盘实用程序 - 物理驱动器 2. 磁盘实用程序 - 容器

现在,尝试操纵容器的大小时会发生以下情况:

$ sudo diskutil apfs resizeContainer disk2s2 0
Password:
Started APFS operation
Error: -69519: The target disk is too small for this operation, or a gap is required in your partition map which is missing or too small, which is often caused by an attempt to grow a partition beyond the beginning of another partition or beyond the end of partition map usable space
Run Code Online (Sandbox Code Playgroud)

这是我尝试的第二种方法,尝试缩小然后回收:

$ sudo diskutil apfs resizeContainer disk2s2 500g
Started APFS operation
Aligning shrink delta to 499,995,135,488 bytes and targeting a new physical store size of 499,999,997,952 bytes
Determined the minimum size for the targeted physical store of this APFS Container to be 499,898,105,856 bytes
Error: -69605: There is not enough free space in the APFS Container for this operation
Run Code Online (Sandbox Code Playgroud)

Tet*_*jin 3

APFS 卷自动调整大小。容器显示 1000GB,即整个驱动器,或多或少;卷应显示当前使用的空间。您之前的空间不足使得它看起来是正确的。

\n

这是我的\xe2\x80\xa6 [相同的 Mac Pro,相同的操作系统,安装在 PCI 卡上的磁盘,这使它认为它是外部的]

\n
/dev/disk6 (external, physical):\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\n   0:      GUID_partition_scheme                        *1.0 TB     disk6\n   1:                        EFI EFI                     209.7 MB   disk6s1\n   2:                 Apple_APFS Container disk7         998.2 GB   disk6s2\n   3:                  Apple_HFS eDrive                  25.6 GB    disk6s3\n\n/dev/disk7 (synthesized):\n   #:                       TYPE NAME                    SIZE       IDENTIFIER\n   0:      APFS Container Scheme -                      +998.2 GB   disk7\n                                 Physical Store disk6s2\n   1:                APFS Volume KickMeHard              401.8 GB   disk7s1\n   2:                APFS Volume Preboot                 21.2 MB    disk7s2\n   3:                APFS Volume VM                      20.5 KB    disk7s3\n   4:                APFS Volume Recovery                507.6 MB   disk7s4\n
Run Code Online (Sandbox Code Playgroud)\n