You may get this error if your disk has only read only mode. You have to disable read-only mode on the USB disk first. Now follow the below given steps.
$ hdparm -r0 /dev/sxx
$ wipefs --all /dev/sxx --force
- Make a new partition on the disk using fdisk:
$ fdisk -cu /dev/sxx
then ‘d‘ to delete and ‘w‘ to write.
$ mkfs.ext4 /dev/sxx
Hope this will solve your error.