Before explaining yourself in detail how to merge two partitions on Mac, it seems only right to make some clarifications regarding the peculiarities of the latest versions of macOS, or rather, of the file system APFS used by the latter, and the conditions necessary for the union procedure to be successful.
So, you need to know that Apple's new APFS file system has the ability to create various containers within the same disc. Containers can be defined, in a very small way (therefore not very correct from a technical point of view), as "virtual partitions" used to better organize the files on the disk: in a nutshell, it is possible to have different drives (eg. the "Data" container in which to store your data and the "Work" container in which to store all the files relating to the job) on the same disk without actually having to partition it and also having the possibility to freely delete any container without having to waste time to manually reallocate the freed space (but still losing the files that were contained in it).
It goes without saying that merging partitions of a disk formatted with APFS (and divided into various containers) is different than merging partitions of a disk formatted with the old file system HFS / HFS + or with other popular file systems, such as FAT32 o exFAT.
Another very important thing to underline is that, for any file system, only adjacent partitions can be joined. This means that if, for example, you have a disk partitioned into four parts (A, B, C e D), you can merge A e B deleting B and embedding free space in A, but you can't do the same thing with A e D.
Likewise, regardless of the file system used, merging two partitions means delete all data present in one of them, and then incorporate the space obtained in the "surviving" partition. Before proceeding, therefore, make a backup of all the data on the disk (and not only on the partition you are going to delete, since caution is never too much!).
Finally, I point out that the information you are about to read is valid for all types of drives: SSD, mechanical disks, internal disks and external disks. Enjoy the reading!
How to merge partitions on Mac
Now that you have all the information you need, I would say that you are ready to merge two partitions on Mac.
The first step you need to take, if you intend to merge partitions of an external drive, is to connect the drive to the computer. If you have a MacBook of recent production with sun Thunderbolt 3 / USB-C ports, to do this, you may need a USB-A to USB-C adapter.
At this point, you just have to start Disk Utility, by clicking on the appropriate icon in the folder Other of Launchpad or looking for the application in Spotlight.
In the window that opens, then select the nome dell'unità in which you want to merge the partitions from the left sidebar (eg. Macintosh HD, if it is the Mac disk), click the button Partition (above) and answer Partition notice that appears on the screen.
In the next window, move to the pie chart, click on portion of the graph relating to the partition to be deleted (make sure it is adjacent to the partition you want to expand) and click the button [-], below, in order to order their cancellation.
Then, if necessary, use the mouse to expand the portion of the graph relating to the partition to be expanded and make sure that this goes to cover all the area left free from the deleted partition (help yourself with the field Sizes, to understand if you are really using all the available space).
Infine, click your button Apply (bottom right), confirm and wait for the deletion of the first partition and expansion of the remaining one to be completed.
If you are working on the system disk, there may be some moment of apparent macOS freeze at this stage.
How do you say? You don't want to merge two disk partitions, but two AFPS containers? In this case, all you have to do is select the volume to be deleted from the Disk Utility sidebar, press the button [-] placed at the top and respond Delete notice that appears on the screen.
The space obtained by deleting the container will automatically be made available for the remaining containers on the drive.
Merge partitions on macOS Yosemite and earlier
You have an old Mac still equipped with macOS 10.10 Yosemite or an older version of the Apple operating system? No problem, I'll explain immediately how to proceed on the latter as well.
Be vuoi scoprire how to merge two partitions on macOS Yosemite and earlier, the first step you need to take is to start theDisk Utility located in the folder Other of the macOS Launchpad.
A window will open with a list of all hard drives and drives connected to the computer on the left. Then select the drive in which you want to unify the partitions and go to the tab Partition which is located at the top.
At this point, you have to delete one of the two partitions you want to join (the smallest) and then incorporate the freed space into the other. By doing this, however, all the data contained within the deleted partition will be deleted. This means that you must first copy them to another drive or to a folder on the partition that you will leave intact and then proceed with formatting.
To wipe a partition with Disk Utility, select its name from Partitions scheme and click on the button first - which is at the bottom of the window and then up Remove. This should take a few minutes to wait.
Once the procedure is complete, you can merge two partitions on Mac selecting the partition that has remained intact since Partitions scheme of Disk Utility and dragging its box downwards with the mouse (you have to click on the three lines located at the bottom right and then drag down). In this way, you will incorporate in the primary partition the space you have freed by deleting the secondary one.
To make the changes effective click on the button first Apply and then Partition. Again, the procedure should take a few minutes but it all depends on the size of the partitions to be merged and the speed of the disk.
How to merge partitions on Mac from Terminal
As we have just seen together, merging two partitions on Mac is not a very complicated operation; on the other hand Disk Utility is a very intuitive tool and allows you to perform the operation in question in a fairly safe way, making the user understand well on which disk / partition he is going to act.
In some cases, however, it might be useful merge two partitions using Terminal, then the command line: a decidedly more "difficult" environment than that offered by Disk Utility, in which, if you do not proceed with the utmost attention, there is a serious risk of deleting partitions and drives that, instead, should have remained in place.
If, despite this, you want to address this topic, perhaps because Disk Utility returned an error message or because you are simply curious to increase your knowledge of the Mac world, let me explain how to proceed.
But be careful: I take no responsibility for any accidental deletion of drives / partitions following a careless use of the macOS Terminal (or Disk Utility, which I told you about earlier). Understood? Perfect, then let's proceed.
To merge partitions of a disk formatted in AFPS from the command line, you must first open the terminal, recalling it from the folder Other of Launchpad or by looking for it in Spotlight. Once its main window is displayed, issue the following commands (followed by pressing the key Submit on the keyboard).
- diskutil list, to view the list of disks, partitions and volumes connected to the computer (including, obviously, the internal Mac disk). In this way, you will know the identifier of the partitions on which to go to act.
- sudo diskutil apfs deleteContainer [partition identifier], where instead of [partition identifier] theIDENTIFIER of the partition to be deleted (eg. disk0s3). This command deletes the contents of the AFPS partition. For its execution, you will need to type in the admin password of the Mac.
- sudo diskutil eraseVolume "Free Space"% noformat% / dev / [partition identifier], where instead of [partition identifier] theIDENTIFIER of the partition to be deleted (eg. disk0s3). This command completely wipes the AFPS partition.
- sudo diskutil apfs resizeContainer [partition identifier to expand] 0, where instead of [partition identifier to expand] theIDENTIFIER of the partition to which to assign the space freed from the deleted partition (ex. disk0s2). This command expands the indicated partition using the space freed from the deleted one (obviously, as long as these are adjacent, as explained at the beginning of the guide).
Please note that in the case of external drives, before proceeding, it may be necessary eject the volume to be deleted, by right-clicking on its name in the sidebar of Disk Utility and selecting the voice Eject give the menu check if you press.
If you want to merge partitions of a disk formatted in HFS / HFS +, FAT32 or other file systems, you must use these other commands instead.
- diskutil list, to view the list of disks, partitions and volumes connected to the computer, in order to find out the identifier of the partitions on which to act.
- diskutil erasevolume "Free Space" "" / dev / [disk], where instead of [disk] enter the name of the partition to be deleted (eg. disk0s3). This command goes to delete the partition.
- diskutil resizevolume / dev / [disk] R, where instead of [disk] enter the name of the partition to expand (eg. disk0s2). This command expands the indicated partition using the space freed from the deleted one (obviously, as long as they are adjacent).
The duration of the procedure varies from case to case, also based on the performance of the unit on which you are going to act.How to merge two partitions on Mac