Ubuntu – Can’t apply partition table on pen drive and create partition

gpartedpartitioning

I have pen drive that shows unloacted.I have tried many tools as gparted,fdisk,gpart,testdisk etc. but i can't make it usable.
Here is my test results:

Fdisk:

$ sudo fdisk -l
....
Disk /dev/sdc: 8010 MB, 8010194944 bytes 
247 heads, 62 sectors/track, 1021 cylinders, total 15644912 sectors 
Units = sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disk identifier: 0xd0e2392f 
Disk /dev/sdc doesn't contain a valid partition table 

So this device size is correctly identified as 8010MB (8GB) and is located at /dev/sdc. Interestingly, fdisk has reported that this device is not having a valid partition table. So something has happened to the partition table and I wanted to fix it with the help of fdisk command as follows

$sudo fdisk /dev/sdc 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF     disklabel 
Building a new DOS disklabel with disk identifier 0x4c9b7827. Changes will  remain in memory only, until you decide to write them. 
After that, of course, the previous content won't be recoverable. 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 
Command (m for help): w 

The partition table has been altered! Calling ioctl() to re-read partition table

Then i have tried to partition the pendrive

#sudo fdisk /dev/sdc 
... 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 
Command (m for help): n 
Partition type: primary (0 primary, 0 extended, 4 free) extended Select (default p): p 
Partition number (1-4, default 1): 1 
First sector (2048-15644911, default 2048): Using default value 2048 
Last sector, +sectors or +size{K,M,G} (2048-15644911, default 15644911): Using default value 15644911 
Command (m for help): w 
The partition table has been altered! 
Calling ioctl() to re-read partition 

After doing this my pen drive still unlocated.Then i try to solve using gparted.

Gparted results:

I used "gparted" tool to add a partition table. As shown in above image, gparted shows this device at /dev/sdc with Partition=unallocated and FileSystem=unallocated, so it also identified that there was an issue. So I tried adding a partition table [by Device -> Create Partition Table…] of msdos type, but GUI displayed an error message as "Error while creating partition table". Command line also had some issues listed as below

$sudo gparted
====================== 
libparted : 3.1
====================== 
/dev/sdc: unrecognised disk label 
/dev/sdc: unrecognised disk label

Now how can i solve the problem. thanks in advance.

Best Answer

You might try zeroing out the drive as mentioned in the comments by running...

# dd count=1 bs=512 if=/dev/zero of=/dev/sdx && sync

... where sdx is the drive you're wanting to format.

BE VERY CAREFUL TO ENSURE THAT YOU ARE DOING THIS AGAINST THE RIGHT DRIVE!

Then create a new partition table...

# cfdisk /dev/sdx
# mkfs.ext4 /dev/sdx1
# e2label /dev/sdx1 USB_STICK

This combined with running gparted with...

gksudo gparted

...worked for me. I had a USB stick that I dd'd an iso on to ot use for booting then had trouble recovering it. These were the steps I took and it as usable again.

Related Question