1
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk2
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk2s1
                    (free space)                         500.1 GB   -
   2:                 Apple_APFS ⁨Container disk3⁩         499.9 GB   disk2s2

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +499.9 GB   disk3
                                 Physical Store disk2s2
   1:                APFS Volume ⁨时间机器⁩                422.9 GB   disk3s2

MacOs version: Big Sur 11.7

CPU: Intel Core i7

MacBook Pro

I have some free space(500.1GB) before the disk2s2, I want to merge the free space into disk2s2. When I run diskutil apfs resizeContainer disk2s2 0 it always say

Started APFS operation
Error: -69743: The new size must be different than the existing size

In Disk Utility.app only show one Partition. disk3s2 is a Time Machine volume that can't move or copy the backup files in this volume. enter image description here

I accept @Andy Griffiths's answer.

I reformatted the entire physical disk and lost my time machine backups. Copy or move the backups seems not possible to do in a single physical disk.

coolboy
  • 13
  • There are all ready accepted answers to this question. However, the procedure can vary based on the version of macOS. Could you edit your question and include the version of macOS? – David Anderson Mar 15 '23 at 12:45
  • Hi, just edited. – coolboy Mar 15 '23 at 15:30
  • Does this answer your question? How to make remove free space and make APFS container take it up. I understand your question is for an external drive which does not have macOS installed. I assume you can make the appropriate changes to the accepted answer given in the linked question. – David Anderson Mar 15 '23 at 19:06
  • Yes, this answered my question.https://apple.stackexchange.com/questions/406962/how-to-make-remove-free-space-and-make-apfs-container-take-it-up But... APFS Volume ⁨时间机器⁩ 422.9 GB disk3s2 is a Time Machine volume, I can't move or copy the backup files to the new partition. – coolboy Mar 16 '23 at 01:55
  • @coolboy You should have mentioned this at the beginning, and provided a translation of the Volume label. In that case your only option is to just create a new volume in the free space and use it as is, or reformat the entire physical disk and make a fresh start with your Time Machine backups. – Andy Griffiths Mar 16 '23 at 09:08

2 Answers2

2

To add space to APFS partition containing the 时间机器⁩ volume, free space would have to occur after this partition. One possible solution would be to move this partition to occur immediately after the EFI partition. This would result in the free space occurring after this partition. You could then use the diskutil apfs resizeContainer disk2s2 0 command.

I do not know if moving (or copying) an APFS partition would mess up a Time Machine backup contained within. I can say, at least two users (including myself) have posted success in moving APFS partitions as documented in question Can't resize APFS container.

Moving an APFS partition probably would require third party tools. Examples are given below.

Possible Third Party Tools

  • GNOME Partition Editor (GParted)

    This may require use of a wired keyboard and/or mouse.

    This is a free product. Instructions for creating and using a bootable GParted flash drive is given here. Also, note that Ubuntu Live bootable USB flash drives come the GParted already installed. So another option would be to download Ubuntu Live and use Etcher to create the flash drive.

    Basically, use this product to move the APFS partition containing the 时间机器⁩ volume to occur immediately after the EFI partition. Next, use the diskutil command to add free space created after the APFS holding.

  • Paragon Hard Disk Manager for Mac

    To use this would require a purchase. You install this product as an application. Basically, use this product to move the APFS partition containing the 时间机器⁩ volume to occur immediately after the EFI partition.

    Note: Apparently, you can also create Bootable Recovery Media. In your case, I do not think the using Bootable Recovery Media would be necessary.


I should point out that since the free space shown in your question is larger than the current APFS partition, you could instead do the following as outlined. This would be safer, since the original APFS partition would remain unchanged until a successful copy was achieved.

  1. Create an APFS partition identical in size to the current APFS partition. Create the new partition immediately after the EFI partition.
  2. Use a third party tool (such as GParted) to copy the original APFS partition to the new APFS partition.
  3. Prevent macOS from mounting the original APFS partition by either changing the partition type to something macOS will not mount (such as Linux) or remove the partition from the GUID Partition Table (GPT).
  4. Boot to macOS and verify the copy is good.

If everything is OK, then if necessary use the gpt command to remove the old APFS partition. You could then use the diskutil apfs resizeContainer disk2s2 0 command.

  • 1
    Just wanted to reply and note that this worked perfectly for me. I used a GPARTED live USB thumb drive to boot, right clicked on the APFS container, selected "Move/Resize", dragged it all the way to the left, rebooted, and ran the diskutil apfs resizeContainer disk2s2 0 command. Everything worked, macOS booted just fine! – lazd Apr 03 '23 at 15:28
1

You cannot extend a container backwards. You will need to create a new container and volume in the free space, copy the data (luckily the free space is the same as the existing container, so you should have no space issue), then erase the older container (currently disk3). Then you can extend the new container to the end of the disk.

See my previous answer to the same issue. https://apple.stackexchange.com/a/444629/221742

Use the addPartition verb to add a new partition that is an APFS container, and create an APFS volume, following the EFI partition disk2s1. Note, the partition specifier here is unique to your example while your external disk is connected as currently. If in doubt, check your layout again.

% diskutil addPartition disk2s1 apfs NewAPFS 0

All this is covered in existing answers, such as the excellent https://apple.stackexchange.com/a/407055/221742

  • Hi,Thank you, But how to create a new container and volume in the free space? – coolboy Mar 15 '23 at 16:29
  • disk3s2 is a Time Machine backup volume, I can't move or copy the files in it. – coolboy Mar 16 '23 at 01:51
  • @coolboy You should have mentioned this at the beginning, and provided a translation of the Volume label. In that case your only option is to just create a new volume in the free space and use it as is, or reformat the entire physical disk and make a fresh start with your Time Machine backups. – Andy Griffiths Mar 16 '23 at 09:08
  • only option? You mean the only options that you know of. For example, I wonder if moving the entire partition with GParted would work. – David Anderson Mar 16 '23 at 10:27
  • Well, as there's no native macOS binary, the live-CD is Intel only and I have an M1 Mac, I'm not exactly setup to experiment in that direction. I know the OP is on Intel, but I can't recommend a solution I can't test. Will your ASR method work with TM-flagged filesystems? – Andy Griffiths Mar 16 '23 at 13:50
  • Well, after researching the internet, I believe none of answers you have linked to will be helpful. As you have already stated, the OP should have mentioned the use of Time Machine. – David Anderson Mar 16 '23 at 15:11
  • Here's a thing though... asr and CCC will copy a TM volume, but you have to remove the 'Backup' APFS role from the source before copy, and add it to the destination after copy: diskutil ap changevolumerole <source volume> clear and diskutil ap changevolumerole <destination volume> T. I'll see if I can incorporate this into the answer, but it's possibly risky. – Andy Griffiths Mar 16 '23 at 15:20