4

So basically I partitioned my HDD on my MacBook Pro so that I could install Linux and dual boot. But I realized I don't really need Linux anymore but it doesn't appear on my regular disk utilities, only my one MacBook HDD does.

I type diskutil list in my terminal and this shows up

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         121.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            91.0 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                        EFI                         29.3 GB    disk0s4

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +90.6 GB    disk1
                                 Logical Volume on disk0s2
                                 B0DF20B2-B674-46B3-B337-57F6A89A500F
                                 Unlocked Encrypted

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *248.4 GB   disk2
   1:        Apple_partition_map                         32.3 KB    disk2s1
   2:                  Apple_HFS 256 GB                  248.3 GB   disk2s3

I'm basically trying to remove 4 under disk0. Any help would be appreciated.

1
  • A 29.3 GB EFI partition is unusual. Please enter the command diskutil info disk0s4 and post the results. Also, what version of OS X (macOs) are you running? Commented Nov 7, 2017 at 7:32

3 Answers 3

2

The command

sudo diskutil eraseVolume jhfs+ MyVolume disk0s4

should make the partition visible in the Disk Utility application. This command will erase the contents partition 4. You should probably quit the Disk Utility application before entering this command.

Once disk0s4 becomes visible in the Disk Utility application, you can remove the partition and reclaim the space.

1

If you want to remove the partition and not create a new one for disk0 partition 4, here's the command:

diskutil eraseVolume free free disk0s4

The "free free" instructs eraseVolume to delete the partition without creating a new one.

You can then add a new partition using addPartition like this:

diskutil addPartition disk0 %Apple_APFS% MYNEWVOLUMENAME 0

The last 0 means that the new volume would fill the unused space on the disk.

Note: As a caution to anyone not experienced with modifying partition tables, be very, very careful. This can easily erase all your data if you delete the wrong partition. Check twice or three times before you press enter.

-2

diskutil eraseVolume does NOT remove any partition data

eraseDisk format name [APM[Format] | MBR[Format] | GPT[Format]] device
                Erase an existing disk, removing all volumes and 
                writing out a new partitioning scheme containing one new empty file system 
                volume.  If the partitioning scheme is not specified, then an appropriate 
                one for the current machine is chosen.  Format is discussed below in the 
                section for the partitionDisk verb.  
                Ownership of the affected disk is required.

What you want is zeroDisk

zeroDisk   [force] [short] device
                Erase a device, writing zeros to the media.  The device can be a whole-disk
                or a partition.  In either case, in order to be useful again, zeroed 
                whole-disks will need to be (re)partitioned, or zeroed partitions will need 
                to be (re)formatted with a file system, 
                e.g. by using the partitionDisk, eraseDisk, or eraseVolume verbs.

Taken from the man pages of diskutil

If you had sensitive data, you may even wish to use secureErase and use an option to make the data irrecoverable (like if you're giving away/donating your PC/Mac/HDD/SSD)

1
  • 1
    What does eraseVolume or eraseDisk have to do with the OP's question? I do not see either mentioned. Using zeroDisk on disk0s4 would not make the partition visible in the Disk Utility application. Nor would zeroDisk remove this partition. So why offer the use of zeroDisk as a solution? Commented Sep 21, 2020 at 21:59

You must log in to answer this question.

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