Read this first to understand your situation:
You may be facing this error because a partition table may have been created inside this partition and now it has subpartitions. The partition can be loop mounted and recognized as a full drive containing subpartitions inside it. One way to create this environment is to run:
parted /dev/sdg1 and force it to consider the partition as a complete device. After you're inside parted you would run mktable msdos to create an MBR partition table and after this you will be able to create subpartitions.
Now you may understand what happened, here's a possible solution. An easy way to clear a partition table is to write at the beginning of the device. You can do it in Unix-like systems by using the command dd. Giving specific parameters for it to wipe just the partition table:
dd if=/dev/zero of=/path/to/your/partition bs=1048576 count=1
This command will read zeroes from "/dev/zero" 1048576 bytes at a time (1MB total) and do it only once. The first 1MB of an MBR disk contains info about the partitions and a bootloader in case the disk has an OS installed in it. A sane partition creation procedure will always jump the first 1MB of data in the disk and create the first partition after it in order to not corrupt or overwrite this valuable data.
In your specific case, you may change the example path to /dev/sdg1 (the partition that has a partition table) and run the dd command, this way the program may no more find a partition table and proceed.
ddto wipe the first few blocks of the USB. Trydd if=/dev/zero of=/dev/sdg bs=512 count=100ddaccording to fpmurphy's advice, but it is risky, because there is no final checkpoint. A minor typing error is enough to damage valuable data. I suggest that you use mkusb for this purpose.ddwill start doing what you tell it to do without any question. It does not ask for a confirmation (at a 'final checkpoint'), where you can double-check, that the command points to the correct target device.