Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to format flash drive but accidentally I deleted its file system or something. Now the system doesn't recognize the flash drive, how is it possible to recover it?

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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: 0x000efcdb

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       60307   484408320   83  Linux
/dev/sda2           60307       60802     3975169    5  Extended
/dev/sda5           60307       60802     3975168   82  Linux swap / Solaris

Disk /dev/sdb: 4073 MB, 4073717760 bytes
126 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 7812 * 512 = 3999744 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007dd56

   Device Boot      Start         End      Blocks   Id  System
share|improve this question
    
Can you post the output of running sudo fdisk -l on your system with the flash drive plugged in? – digitxp Aug 21 '11 at 21:11
    
done, the USB drive is 4073 Mb – Sergey Aug 21 '11 at 21:15
up vote 2 down vote accepted

If you want to format it, i.e. not recover the data on the pen-drive, use the below commands. From your fdisk output, it seems the drive is located at /etc/sdb. You might want to double check this.

Now to format it to ext3 (For use on Ubuntu only), execute:

$ sudo mkfs.ext3 /dev/sdb

If you want to create an NTFS file system (For use on Ubuntu and Windows), execute:

$ sudo mkfs.ntfs /dev/sdb
share|improve this answer

@BloodPhilia has the right answer, with one caveat:

You may want to use FAT instead of NTFS if you want to use this with a wider array of systems; from the few I have lying around it seems FAT is the default format for SD cards and pen drives.

Also, NTFS has--at least in the past--not been recommended for use on removable media.

On CentOS that command would be:

$ sudo mkfs.vfat /dev/sdb

It may be "mkfs.msdos" on others.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .