Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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. 
Fixing ntfs_attr_pread_i:ntfs_pread failed: Input/output error 
Failed to read NTFS$Bitmap:Input/output error 
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
share|improve this question

2 Answers 2

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.


image of gparted window with numbered steps


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.)

share|improve this answer
    
Thank you very much, i used dd command, now it has erased partition table successfully. After that if i connect, the dmesg shows as "[88143.437001] sdb: unknown partition table". But i am not able to create partiond using fdisk /dev/sdb. It says unable to find the node. The dmesg shows as [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 –  yesuraj May 13 '12 at 6:45

Assuming your pen drive is /dev/sdd (please make sure you know which it is)

open a terminal

'sudo fdisk /dev/sdd'

delete the ntfs partition, and make a new one (or any other type of partition)

'd'

should automagically destroy the only partition.

at this point you can hit 'w' and write the changes and use your fav method of making a new partition. Or continue below.

'n' (create a new partition) 'p' (primary partition) '1' (partition number) 'enter' (for default first sector) 'enter' (for default last sector)

't' (for partition type) 'c' or '83' '86?' fat32 linux ntfs(?) 'w' to write and exit.

I can not stress enough to make sure you have the right device when you do this.

share|improve this answer
    
Hi, thank you very much for your reply. I already did the same what ever you have mentioned. But no use. here is how it works –  yesuraj May 11 '12 at 6:36
    
well, after that, you would need to eject the drive, plug it in again, and create a new filesystem on the partition. –  Matt Barnes May 11 '12 at 15:33
    
When i pressed 'w' after deleting the partition, it took more time than usual time. After that i removed the pen drive and re-inserted, again the same deleted partition is present. if i simply type fdisk command without removing the pen drive after the partition delet on the same device node, then it say unabe to open Here I 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 –  yesuraj May 12 '12 at 8:21
    
AFTER THAT, WITHOUT REMOVING THE PEN DRIVE, WHEN I USE fdisk root@yesuraj-ubuntu:~# fdisk /dev/sdb Unable to open /dev/sdb –  yesuraj May 12 '12 at 8:26
    
@yesuraj - please add important information such as the above comments as edits to your question. Stuff in comments tends to get easily missed. Thanks. –  fossfreedom May 12 '12 at 21:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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