2

I've tried to use a case-sensitive file system, but I had some trouble. So I've split the hard drive into two partitions, added a case-insensitive volume and cloned it. That worked perfectly.

Then I wanted to reclaim the space from the old, now unused volume. I tried with Disk Utility, but I could not find an option to remove the partition. So I did some searching and learned that I can do it via the terminal.

I ran these commands:

diskutil apfs deleteContainer disk0s2
diskutil eraseVolume "Free Space" %noformat% /dev/disk0s2

These worked and the old container disappeared. But when I tried to resize the main disk using diskutil apfs resizeContainer disk1 0, I get this output

> diskutil apfs resizeContainer disk1 0
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

Here are the details:

diskutil list:

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            149.0 GB   disk1s1
   2:                APFS Volume Preboot                 42.1 MB    disk1s2
   3:                APFS Volume Recovery                517.0 MB   disk1s3
   4:                APFS Volume VM                      2.1 GB     disk1s4

diskutil apfs list:

APFS Container (1 found)
|
+-- Container disk1 DB71F1FD-A757-423F-96BF-45C3B28AE3BE
    ====================================================
    APFS Container Reference:     disk1
    Size (Capacity Ceiling):      249981587456 B (250.0 GB)
    Capacity In Use By Volumes:   151823781888 B (151.8 GB) (60.7% used)
    Capacity Not Allocated:       98157805568 B (98.2 GB) (39.3% free)
    |
    +-< Physical Store disk0s2 45B26EA7-FDB6-4F34-841A-C207121E6F25
    |   -----------------------------------------------------------
    |   APFS Physical Store Disk:   disk0s2
    |   Size:                       249981587456 B (250.0 GB)
    |
    +-> Volume disk1s1 632B07D6-69D2-474C-ADA1-44110EF96300
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s1 (No specific role)
    |   Name:                      Macintosh HD (Case-insensitive)
    |   Mount Point:               /
    |   Capacity Consumed:         148978905088 B (149.0 GB)
    |   FileVault:                 Yes (Unlocked)
    |
    +-> Volume disk1s2 D04926EF-CDBF-4609-AE06-CBE1EF7178C3
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s2 (Preboot)
    |   Name:                      Preboot (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         42102784 B (42.1 MB)
    |   FileVault:                 No
    |
    +-> Volume disk1s3 B0A726BB-DC92-4408-AB22-74F8E34CE611
    |   ---------------------------------------------------
    |   APFS Volume Disk (Role):   disk1s3 (Recovery)
    |   Name:                      Recovery (Case-insensitive)
    |   Mount Point:               Not Mounted
    |   Capacity Consumed:         516956160 B (517.0 MB)
    |   FileVault:                 No
    |
    +-> Volume disk1s4 9AEC124F-E782-4953-82E9-396CA674EAFC
        ---------------------------------------------------
        APFS Volume Disk (Role):   disk1s4 (VM)
        Name:                      VM (Case-insensitive)
        Mount Point:               /private/var/vm
        Capacity Consumed:         2147504128 B (2.1 GB)
        FileVault:                 No

As you can see, the total size is 500 GB, but the currently used disk1 container has only 250 GB available.

I spend a good part of the day trying to figure this out, but I could not find a way to resize the container to reclaim the missing ~250GB of space. I'm looking for a way to do this without erasing the whole disk in the process. What can I try?

2

Your question looks similar to this one. Take a look at the output of gpt show disk0 and you'll probably find that the free space physically exists at the start of the container, and not the end of it. You'll need to physically move the partition extents if that's the case (see my other answer).

  • Thanks for the answer. Sounds like this is the problem I'm experiencing, but I have to try it out to verify it. – Marko Grešak Mar 6 at 9:26
  • When I enter: # gpt show disk0 I get: gpt show: unable to open device 'disk0': Operation not permitted – ktappe Jun 19 at 5:33
  • @ktappe are you doing that as root? – parzival Jul 12 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .