# Ubuntu – I am not able to delete a corrupt NTFS partition on the pen drive. How to force its deletion

file formatpartitioning

I formatted my 16GB pen drive with the NTFS file system in windows vista. After that I started copying some files. However, only a few files were copied to the pen drive before the copy operation hung. So I cancelled the copy operation.

Now I am unable to use the pen drive. I DON'T REALLY NEED ANY FILES THAT I COPIED TO THE PENDRIVE. I JUST WANT TO USE THE PENDRIVE AGAIN.

I have tried using Ubuntu to format the pen drive. But when i use fdisk to delete the partition, it looks like it is working fine but in fact it does not delete the partition. Also I am unable to format it with any other file system.

When I tried to use gparted, it throws the following error:

Error mounting: mount exited with exit code 14: The disk contains an unclean file system(0,0).
The file system wasn't safely closed on window.
NTFS is either inconsistent, or there is a hardware fault, or it's a softRAID/FakeRAID hardware.
In the first case run chkdsk /f on Windows then reboot into windows twice.
The usage of  the /f parameter is very important!.
If the device is a SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper directory, (e.g. /dev/mapper/nvidia_eahaabcc1).
Please see the dmraid documentation for more details


When I searched the Internet I found help on how to recover. But I don’t want to recover, I want to format it again.

When I pressed w after deleting the partition, it took more time than previously. After that i removed the pen drive and re-inserted, but the partition I had deleted was still present.

If I simply type the command fdisk /dev/sdb without removing the pen drive after the partition is deleted, then it returns the error message Unable to open /dev/sdb.

Here are the steps that I followed:

root@yesuraj-ubuntu:~# fdisk /dev/sdb
Command (m for help): d
Selected partition 1
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks


THE DEMESG PRINTS ARE AS FOLLOWS,
[ 6139.774753] usb 2-1.3: reset high speed USB device number 4 using ehci_hcd
[ 6154.816941] usb 2-1.3: device descriptor read/64, error -110
[ 6169.968908] usb 2-1.3: device descriptor read/64, error -110
[ 6170.158427] usb 2-1.3: reset high speed USB device number 4 using ehci_hcd
[ 6185.200638] usb 2-1.3: device descriptor read/64, error -110
[ 6200.352572] usb 2-1.3: device descriptor read/64, error -110
[ 6200.542093] usb 2-1.3: reset high speed USB device number 4 using ehci_hcd
[ 6205.559460] usb 2-1.3: device descriptor read/8, error -110


### I used the dd command and it erased the partition table.

But now when I connect the pen drive, dmesg contains this error message:
[88143.437001] sdb: unknown partition table.

I am not able to create a partion using fdisk /dev/sdb. The error message says that it is unable to find the node.

Other messages from dmesg follow below.

[87100.531596] usb 2-1.3: new high speed USB device number 39 using ehci_hcd
[87130.915257] usb 2-1.3: new high speed USB device number 40 using ehci_hcd
[87135.932647] usb 2-1.3: device descriptor read/8, error -110


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.
1. Select the pen drive as the current gparted device.
2. Select the free space region on the pen drive.
3. Select Create Partition Table in the Device menu and create an MS-DOS style partition table.
4. 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.)