Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I format the write protected pendrive?

share|improve this question
Relevant question on Ask Ubuntu. – JMCF125 Mar 23 '14 at 22:49
up vote 7 down vote accepted

Unless its write protected with a hardware switch, that shouldn't matter. You will need to be root. I assume that by 'format' you mean to delete all the files and recreate the file system. To do this use parted or gparted to create a new partition.

GParted is easy its a graphical application, while parted is from the command line.

But essentially just find which device your drive is ( probably /dev/sdb or sdc some letter after a) and delete the old partition and make a new one.

FAT32 is probably the file system you want, but that's up to you. GParted is pretty easy installs in gnome, probably in your distro's repositories, parted has man pages if you want to go that route and is probably already installed.

Thats pretty much it, but it wont wipe data clean, (i.e. CSI / identity theives couls still get to your data to do that you can use dd to copy over every thing from /dev/zero. but i wont go in to that unless you ask)

share|improve this answer
yes it is /dev/sdb. How can I delete this partition? – Chankey Pathak Jul 19 '11 at 6:22
gparted.sourceforge.net/… is a pretty straightforward guide to whatever you want to do in GParted – loosecannon Jul 19 '11 at 14:55

Here is a link to the ubuntu forums where someone asked a very similar question.

You will be using fdisk. You will need to know what device you are working with first. This can be done by running the following. First make sure your usb drive is not plugged in. Then run:

ls /dev/sd*

Once you have done that, put in your pen drive and run the above command again. Whatever drive (ex sdc) was not there before is your pen drive. For now we will call it sdX. Now you will need to use fdisk.

fdisk /dev/sdX

From there you will want to wipe out your partition table, make a new primary partition and choose which type of partition you want it to be, more on that here.

Now depending on what filesystem you are wanting to create there are a number of utilities. From here there you will need to format the drive. There are different options for packages depending on distribution and what you want to format the drive to but in general the most used ones that I have seen are mkdosfs for formatting ntfs and e2mkfs for ext4.


As loosecannon said, it really shouldn't matter that it is write protected and also, I was assuming you were looking for a way to do this from the terminal. If you prefer using a gui, loosecannon is right, GParted is the way to go if there is a package for in on your distribution.

share|improve this answer

protected by Anthon May 17 at 20:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.