Remove all partition from USB drive
On 18.04 I've made a bootable pen drive. Now I don't need it. I want to remove the iso9660 partition.
sudo cfdisk /dev/sdb
I tried to delete (it makes) but when I want to save the changes, it fails.
Failed to write disklabel"
It isn't write protected (read-only is 0)
What else should I try?
You can use mkusb with a graphical user interface. You can select
- 'restore to a Standard storage device', or
- 'Wipe the first mibibyte'.
There are more details at the following links to Ubuntu help wiki pages
- mkusb (what it does, and how to install it)
- Postrequisites - restore the USB stick
- mkusb/wipe
If mkusb cannot solve the problem, you can analyze it, and if you are lucky solve it, according to the following link
- Can't format my usb drive. I have already tried with mkdosfs and gparted
Rather than installing any extra software (and if you're comfortable with the command line), I would suggest using the dd
command.
To wipe your USB fire up the gnome-terminal and type
sudo dd if=/dev/zero of=/path/to/usb
As was pointed out in the comments, you may be better off only wipe the MBR so as not to roast the USB
dd if=/dev/zero of=/dev/<path of data drive> bs=512 count=1 seek=0
Edit: Again as stated in comments MBR is in fact not 440 bytes :facepalm:
The non-interactive sfdisk
can do this from the CLI:
sfdisk --delete /dev/sdb
See man sfdisk
for details.
Use gnome-disks. That is the tool I use to remove, create and format partition in my USB drives.
You can easily install it with the command
sudo apt install gnome-disk-utility