Question

I made a mistake with dd and now my external USB disk looks as follows:

$ diskutil list

(... output ...)

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *4.0 TB     disk2
   1:                  Apple_HFS BLA                     268.4 MB   disk2s1
   2:                      Linux                         1.6 GB     disk2s2

Now when I open the disk in Disk Utility, it only shows 268.4 MB, not the full 4 TB it should be. I can't seem to fix it in Disk Utility, but I'm sure it can be done using the command line?

The output of gpt is as follows:

~$ sudo gpt -r show /dev/disk2
       start        size  index  contents
           0           1         MBR
           1        8191         
        8192      524288      1  MBR part 175
      532480     3080192      2  MBR part 131
     3612672  7810357248 

I sense that the solution is something like overwriting the whole disk with zeroes using dd and /dev/zero, but after my previous failure I am now scared that I brick the disk permanently.

Was it helpful?

Solution

This will erase all data that currently exists on the USB drive:

  1. Remove your USB drive.
  2. Open Disk Utility.
  3. In the menu bar, click [View] > [Show All Devices].
  4. Insert your USB drive. You should see the drive appear in the sidebar in Disk Utility as an item whose name is the manufacturer name and model name/number of the drive. Click this item to select it.
  5. Click [Erase] in the top bar.
  6. Enter a name of your choosing.
  7. For the format, choose "MS-DOS (FAT)".
  8. For the scheme, choose "GUID Partition Table". This is required since your drive exceeds 2TiB in size.
  9. Click [Security Options...], move the slider to "Fastest", then click "OK".
  10. Click [Erase].

macOS will enforce the creation of a 200MiB EFI System Partition on GPT-formatted drives. If you want to claim this space, you can either:

  • format the drive using another tool of another OS (e.g. Windows Disk Management, GParted for Linux); or

  • use the gpt command (or an equivalent like gdisk) to manually create a single partition which spans the whole drive, which you will then need to format with a filesystem, e.g. create a FAT32 filesystem using newfs_msdos. If you want to create an EXT filesystem, the mkfs.ext? commands (e.g. mkfs.ext4) can be obtained via Homebrew by running brew install e2fsprogs.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top