3

I have a boot pen drive with the Lubuntu ISO and I wanted to format it. I can not delete files from the pendrive because they are read-only.

I tried to format it as follows:

#umount  /dev/sdb1

#mkfs.vfat /dev/sdb1
mkfs.fat 4.0 (2016-05-06)
mkfs.vfat: unable to open /dev/sdb1: Read-only file system

Could someone helpe me?

  • I've checked answers to similar questions to my own and none have solved.
2
  • 2
    Please add to the question how exactly that pen is write protected. Is it a physical switch? Jan 30, 2017 at 20:16
  • umount the pen ; then dd if=/dev/zero of=/dev/sdb bs=4096 Jan 30, 2017 at 20:18

1 Answer 1

1

You can completely remove a filesystem with wipefs.

In your case (as root):

wipefs --all /dev/sdb

But, just so we're clear on this, make sure you are wiping the correct drive. In other words, double and triple check that dev/sdb is indeed the correct drive, so that you don't delete something else. You have been warned!

Anyway, after that, try to format the drive again.

Here is a link to the wipefs manpage for Ubuntu. And here is another link from the excellent Arch wiki:

To restore the USB drive as an empty, usable storage device after using the Arch ISO image, the iso9660 filesystem signature needs to be removed by running wipefs --all /dev/sdx as root, before repartitioning and reformating the USB drive.

2
  • 2
    I did it but it did not work. wipefs --all /dev/sdb1 --force; umount /dev/sdb1; mkfs.vfat /dev/sdb1; The data on the pendrive is still there when I remount it.
    – Patterson
    Jan 30, 2017 at 19:15
  • 4
    wipefs: error: /dev/sde: probing initialization failed: Read-only file system Aug 31, 2017 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .