How can I format the write protected pendrive?
Unless it's 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 -- it's 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.
That's pretty much it, but it won't wipe data clean, (i.e. CSI / identity thieves could still get to your data; to do that, you can use
dd to copy over every thing from /dev/zero, but I won't go in to that unless you ask).
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:
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.
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.
protected by Anthon May 17 '16 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?