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 have a pendrive with FAT32 filesystem. it is infected with virus dont know which but has autorun.inf and create exe file within folder. I tried to format it with various filesystems and even try to delete it with GParted but couldn't because it says it is write protected i can't even delete files. How to format it?

user@explorerx:~$ sudo fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xbd04bd04

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         498     3998720   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sda2             499       19457   152287585+   f  W95 Ext'd (LBA)
/dev/sda5            5100       10198    40957686    7  HPFS/NTFS
/dev/sda6           10199       14787    36861111    7  HPFS/NTFS
/dev/sda7           14788       19457    37511743+   7  HPFS/NTFS
/dev/sda8             499        5099    36956160   83  Linux

Partition table entries are not in disk order

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc13bc13b

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        9729    78143488    7  HPFS/NTFS
/dev/sdc2            9729       19457    78143488    7  HPFS/NTFS

Disk /dev/sdb: 4194 MB, 4194304000 bytes
112 heads, 47 sectors/track, 1556 cylinders
Units = cylinders of 5264 * 512 = 2695168 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               2        1557     4091904    b  W95 FAT32

updates to karthick87

user@explorerx:~$ sudo fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
     switch off the mode (command 'c') and change display units to
     sectors (command 'u').

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.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

E
share|improve this question
    
Are you sure that you unmount the drive before formatting?Also does your usb drive have a switch on it that converts it to write protected? –  karthick87 Dec 31 '10 at 7:13
    
yes i unmounted drive and there is no any switch it's Transcend 4.0GB China made –  Santosh Linkha Dec 31 '10 at 7:23
    
Look at this link –  karthick87 Dec 31 '10 at 7:42

3 Answers 3

up vote 2 down vote accepted

If anything fails you may need to run the proprietary recovery tool from Transcend to sort of low level reformat your pendrive.

Unfortunately this tool requires Windows, and in addition you need your product serial number (S/N) (in my case this was printed on the product's blister only). You need to contact Transcend in case you lost your S/N.

share|improve this answer

Should be simple. Be sure the drive is unmounted and then delete the current partition after which you will need to create a new partition. I found a pretty good tutorial on how to do this. Worked for me. How to Reformat and Partition a Disk in Ubuntu

share|improve this answer
2  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  jrg Apr 9 '12 at 12:26

did you try:

sudo mkfs.vfat /dev/sdb1

dev should NOT be mounted

share|improve this answer

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.