This question shows up several times in google and th answers never seemed to work properly for my purposes.
Sometimes with USB drives you get an Error: Partition map has no partition map entry!
error message, there is a partition shown as Apple
which can't be deleted.
One problem caused by these garbage partitions is if you attempt to create a new Linux bootable USB, dd
will say it successfully copied the iso to the USB, but it doesn't actually work. The USB may even boot a bit and then hang during installation or even before it fully boots up.
Here's an example using /dev/sdh
you can see there is obviously one 129kB partition, but parted
and gparted
both refuse to delete it. This partition causes parted
to report the incorrect size also, if you note below mine shows 62.9GB
, the flash drive I was using was only 16GB.
$ parted /dev/sdh
(parted) print
Model: Kingston DataTraveler 2.0 (scsi)
Disk /dev/sdh: 62.9GB
Sector size (logical/physical): 2048B/512B
Partition Table: mac
Disk Flags:
Number Start End Size File system Name Flags
1 2048B 131kB 129kB Apple
(parted) rm 1
Error: Partition map has no partition map entry!
Fix/Cancel? f
(parted) print
Model: Kingston DataTraveler 2.0 (scsi)
Disk /dev/sdh: 62.9GB
Sector size (logical/physical): 2048B/512B
Partition Table: mac
Disk Flags:
Number Start End Size File system Name Flags
1 2048B 131kB 129kB Apple
To fix, you can use dd
to nuke the start of the disk. This will zero out the first 16 MiB of the drive. 16 MiB is probably more than enough to nuke any "start of disk" structures while being small enough that it won't take very long. Re: https://unix.stackexchange.com/a/275260/99018
sudo dd if=/dev/zero count=1 bs=2 of=/dev/sdh
Then you may go back into parted
or gparted
and delete the offending partition.