title: Format USB with bad partition table (read-only fs)
body: <p>I have a USB drive that my Ubuntu machine can't format. I think the problem originated when I was using Rufus or UNetBootin inside a Windows VM and got a blue screen. There's no important data on there, I just want to be able to use it. It's probably not worth the trouble but I want to understand the problem in case it happens again. I tried all sorts of tools but none of them seems to be low-level enough to rewrite the partition table. </p>
  
  <p>Here is the output of some of the tools I tried. As you can note, there is no sdb1 or any found partition because the table is unreadable. I can use a Windows host too if the only solution is by using some ".exe" but I'd rather use UNIX terminal tools if possible.</p>
  
  <pre><code>ls -l /dev/ | grep sdb
  brw-rw----  1 root disk        8,  16 Mar 26 10:57 sdb
  
  sudo hdparm -r0 /dev/sdb
  /dev/sdb:
   setting readonly to 0 (off)
   readonly      =  0 (off)
  
  sudo partprobe -s /dev/sdb
  Warning: Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  Warning: Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  Warning: Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  /dev/sdb: msdos partitions
  
  sudo gparted /dev/sdb
  libparted : 3.2
  Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb has been opened read-only.
  /dev/sdb: unrecognised disk label
  
  sudo fdisk -l /dev/sdb
  Disk /dev/sdb: 15 GiB, 16106127360 bytes, 31457280 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  
  sudo partx -l /dev/sdb
  partx: /dev/sdb: failed to read partition table
  
  sudo partx -d /dev/sdb
  partx: specified range &lt;1:0&gt; does not make sense
  
  sudo fsck.fat -n /dev/sdb
  fsck.fat 3.0.28 (2015-05-16)
  Logical sector size (65535 bytes) is not a multiple of the physical sector size.
  
  sudo blkid -pi /dev/sdb
  DEVNAME=/dev/sdb
  MINIMUM_IO_SIZE=512
  PHYSICAL_SECTOR_SIZE=512
  LOGICAL_SECTOR_SIZE=512
  
  sudo wipefs -a /dev/sdb
  wipefs: error: /dev/sdb: probing initialization failed: Read-only file system
  </code></pre>