How to uninitialize an external disk in MacOS

I am attempting to erase an external disk and use it as a backup. I am sure the physical disk is not broken, but it is in a state where I cannot erase, restore, or partition it from Disk Utility.

Trying to restore from an image file yields OSStatus error 22. How can I completely remove all data from the disk? There is nothing on the disk that I need to keep, I just need to make it usable.

Screenshot

I flashed an linux image to the disk, then attempted to erase it to be used as storage.

Output of diskutil list:

     GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk1         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            15.1 GB    disk1s1
   2:              APFS Snapshot com.apple.os.update-... 15.1 GB    disk1s1s1
   3:                APFS Volume Preboot                 322.9 MB   disk1s2
   4:                APFS Volume Recovery                1.1 GB     disk1s3
   5:                APFS Volume VM                      4.3 GB     disk1s4
   6:                APFS Volume Macintosh HD - Data     332.3 GB   disk1s7

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *31.0 GB    disk2
   1:           Linux Filesystem                         718.2 MB   disk2s1
   2:                        EFI ARCHISO_EFI             68.2 MB    disk2s2
   3:       Microsoft Basic Data                         307.2 KB   disk2s3
                    (free space)                         30.3 GB    -

I am not really used to partitioning and formatting disks in MacOS, so any advice would be helpful.


Solution 1:

Is it this disk ?

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *31.0 GB    disk2
   1:           Linux Filesystem                         718.2 MB   disk2s1
   2:                        EFI ARCHISO_EFI             68.2 MB    disk2s2
   3:       Microsoft Basic Data                         307.2 KB   disk2s3
                    (free space)                         30.3 GB    -

If yes you can do :

diskutil erasedisk jhfs+ "Free Name" gpt disk2

You can try

diskutil umountdisk force disk2

Then retry

diskutil erasedisk jhfs+ "Free Name" gpt disk2