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 am trying format an FAT (or FAT32) file system on my ubuntu system, but I am not able to format the device, each time I am getting the error Both FATs appear to be corrupt. Giving up.

I have tried all options like

sudo dosfsck -t -a -w /dev/sdc1
sudo dosfsck -w -r -l -a -v -t /dev/sdc1

but each time the same message comes, can any one guide me how to recover the filesystem, also i don't mind losing data of this drive as this is an external pen drive. Also, can u pl suggest of some method other then booting from a CD with software like GPARTED or something like that.

share|improve this question

1 Answer 1

Rather than trying to fsck the dos partition how about just zero'ing the parition table, create the partition table from new and re-format the DOS partition.

Suppose the USB stick is on /dev/sdc, first make sure /dev/sdc1 is unmounted:

umount /dev/sdc1

Then clear the partition table, say by copying a bunch of zeros over the first few K

sudo dd if=/dev/zero of=/dev/sdc bs=512 count=16

Then run fdisk or parted to create the partitions from clean, e.g. with fdisk I use:

sudo fdisk /dev/sdc
Command (m for help): n
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-7796735, default 2048): <return>
Last sector, +sectors or +size{K,M,G} (2048-7796735, default 7796735): <return>
Command (m for help): t
Hex code (type L to list codes): 6
Command (m for help): w

..note just press return for the First and Last sector questions, fdisk will chose the correct defaults (which will be different to my example above). And then format the partition with VFAT:

sudo mkfs.vfat /dev/sdc1

and then remove and re-insert the drive. It should be cleanly formatted.

share|improve this answer
    
another option instead of dd here would be shred –  Journeyman Geek Feb 19 '13 at 13:04

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.