macOS Disk Utility – Unable to Erase, Reformat, or Repartition USB Drive

disk-utilityhard drivemacos

This afternoon I attempted to mount a .iso of Windows 7 to a bootable USB drive. It's about 370GiB, so more than enough to store it. I did the following to get myself into this mess. Note,/sda/disk2 is the right disk.

mightybee at mightybook.T-mobile.com in [~]   
12:06:27 › sudo dd if=/Users/mightybee/Desktop/en_windows_10_multiple_editions_version_1511_x64_dvd_7223712.iso of=/dev/rdisk2 bs=1m
12:10:21 › diskutil eject /dev/disk2

After that, I was left with a disk that was reformatted to look like this:
diskutil

The disk is not bootable and doesn't do what I wanted it to do. Furthermore, the disk is actually un-reformattable, unreadable, and practically unusable. When I run eraseDisk, I get this:

diskutil eraseDisk FAT32 WINSEVEN /dev/disk2 
Unable to begin erase operation: The target disk is too small for this operation (-69771)

So my question is this: How do I regain the ability to erase and try another method to write to this disk?

Best Answer

Your command should work if your disk looks something like mine below (note disk1 vs disk2):

diskutil list disk1
/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +1.5 GB     disk1
   1:       Microsoft Basic Data WINSEVEN                1.5 GB     disk1s1

I would unmount the disk as opposed to ejecting it next time.

diskutil unmountDisk disk2

You can pull the drive and reconnect it and see if a lower level erase is possible.

diskutil eraseVolume FAT32 WIN8 /dev/disk2s1

I would expect you to use FAT32 with eraseVolume as opposed to eraseDisk so you might need to repartition things first and then try erasing the volume or recreating it.

diskutil partitionDisk disk2 1 MBR FAT32 WINSEVEN R

After the above command - you should have something similar to the below with the exception of disk2 replacing disk1

$ diskutil partitionDisk disk1 1 MBR FAT32 WINSEVEN R
Started partitioning on disk1
Unmounting disk
Creating the partition map
Waiting for the disks to reappear
Formatting disk1s1 as MS-DOS (FAT32) with name WINSEVEN
512 bytes per physical sector
/dev/rdisk1s1: 2923976 sectors in 365497 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=2 drv=0x80 bsec=2929726 bspf=2856 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished partitioning on disk1
/dev/disk1 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        +1.5 GB     disk1
   1:                 DOS_FAT_32 WINSEVEN                1.5 GB     disk1s1