First find out the device: lsblk
Suppose the USB stick is on /dev/sdb
. If any of its partitions are mounted, then unmount them all.
Let's zero out the device. This will completely wipe out all of its partitions and data. Please make sure you dd
the correct device, here in case /dev/sdb
$ sudo dd if=/dev/zero of=/dev/sdb; sudo sync
Use any disk utility of your choice (gdisk
, fdisk
, gparted
) and create a partition on it.
$ sudo gdisk /dev/sdb
Command (? for help): n
Partition number (1-128, default 1): <enter>
First sector (34-15634398, default = 2048) or {+-}size{KMGTP}: <enter>
Last sector (2048-15634398, default = 15634398) or {+-}size{KMGTP}: <enter>
Hex code or GUID (L to show codes, Enter = AF00): 0700
Changed system type of partition to 'Microsoft basic data'
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk1.
The operation has completed successfully.
gdisk doesn't create filesystems, so run ..
$ sudo mkfs.vfat /dev/sdb1