If you are completely, positively, SURE that you want to erase the current contents of your pen drive, then you can try the dd
command as described below.
First, check one last time that /dev/sdb
refers to the pen drive you want to erase. As another answer has pointed out, you want to have no doubt that you are erasing the correct device. (I would probably run the command sudo fdisk -l
as an extra check.)
The dd
command below should write zeros to the first MiB of the pen drive which will erase any partition table. This should completely remove any partitioning.
sudo dd if=/dev/zero bs=1M count=1 of=/dev/sdb
If you decide you want to write zeros to the entire device, just omit the count=1
parameter. This will take longer, of course. How much longer depends on the size of the pen drive you are erasing.
sudo dd if=/dev/zero bs=1M of=/dev/sdb
After you have erased the partition table with zeros, you can partition the drive. I would do this using gparted
simply because I am familiar with that tool and know how to use it.
Here is how I would do it.
- If
gparted
is not already available on your system, install it. You could, for example, use the command below.
sudo apt-get update && sudo apt-get -y install gparted
- Start
gparted
, entering your password when it is requested.
- Perform the following steps.
- Select the pen drive as the current
gparted
device.
- Select the free space region on the pen drive.
- Select Create Partition Table in the Device menu and create an
MS-DOS
style partition table.
- Select New in the Partition menu to create a new primary partition on the pen drive. Or if you prefer, you could close
gparted
at this point and use fdisk
to partition the pen drive.
Note:
If you wanted to do this in Windows I suggest using the DISKPART
command in a command window. Once in DISKPART
select the correct disk and then issue the command CLEAN
.
(You can issue the command HELP CLEAN
while in DISKPART
form more information about what the command does.)
Best Answer
Microsoft made their Windows 10 pen drives read-only to prevent using it for anything other than the intention (based on the comments on the question).