I know this seems like an beginner / dumb question, since an obvious answer would be:

  1. Open Disk Utility
  2. Remove Linux partition

However it seems that it might not be that easy, and that following those steps could actually lead to pretty messed up partition schemes:

I am therefore asking this question in hope for a proper, safe way to remove a Linux partition after a dual boot Mac / Linux, without having to fear going to an hex editor to repair your drive or to use the internet recovery and losing all your data.

I'm running High Sierra 10.13.6 and Ubuntu 18.04, without REFind and no swap partition.

$ diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         180.8 GB   disk0s2
   3:       Microsoft Basic Data                         69.8 GB    disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +180.8 GB   disk1
                             Physical Store disk0s2
   1:                APFS Volume macOS                   69.9 GB    disk1s1
   2:                APFS Volume Preboot                 23.2 MB    disk1s2
   3:                APFS Volume Recovery                515.0 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4
  • I would suggest your question should include the output from diskutil list. Do not insert an image of the output. Just paste the text into the question. Do not worry about formatting the text. Some one will do that for you. Commented Nov 11, 2018 at 17:10
  • There is no 100% safe way to resize a partition. Just backup your data beforehand. You should keep backups anyway. Commented Nov 11, 2018 at 19:07
  • @Wowfunhappy: There is no 100% safe way to use a computer. Just use an abacus instead. Slide rules also work. Commented Nov 11, 2018 at 20:18
  • @DavidAnderson Well, I kind of agree with the first statement. :P The point is, resizing a partition by its nature always carries a risk of data loss, relatively small but greater than the risk when you're just using a hard drive normally. No program is going to change that. It will probably be fine, but OP should make backups first. He/she should make backups anyway of course, but especially before resizing a partition. Commented Nov 11, 2018 at 23:40

1 Answer 1


I assume you have Linux installed in the Microsoft Basic Data partition. Although with Ubuntu 18, I would expect a Linux Filesystem partition type.

The command given below will remove the Microsoft Basic Data partition. The created free space will not appear in diskutil list.

sudo diskutil eraseVolume free none disk0s3

The command given below will add the free space to the APFS container partition. This added space will be available to macOS.

sudo diskutil apfs resizeContainer disk0s2 0

I suppose there will still be some Linux code in the hidden EFI partition. The commands below will remove any Linux code that would cause an icon to appear in the Startup Manager.

sudo diskutil mount disk0s1
rm -R /Volumes/EFI/EFI/Boot
sudo disktuil unmount disk0s1
  • It should be noted that diskutil in this example is performing the exact same operation as can be done with Disk Utility. They very likely run the exact same code under the hood. One is not going to be more "safe" than the other. Commented Nov 11, 2018 at 23:43
  • @Wowfunhappy: That is exactly what happens. The Disk Utility utilizes the diskutil, asr, hdiutil and other Apple commands to preform needed tasks. The diskutil, asr, hdiutil commands utilize the Unix mount, mount_apfs, umount, newfs_msdos, newfs_apfs, newfs_hfs, fsck, fsck_hfs, fsck_msdos, fsck_apfs, etc commands to preform needed tasks. The problem is the Disk Utility application is notorious for doing the wrong thing. This results in having to enter commands to fix problems caused by using the Disk Utility. One might as well just is the commands instead. Commented Nov 12, 2018 at 2:41

You must log in to answer this question.

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