LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-09-2016, 09:56 AM   #1
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Unhappy Cannot format corrupted USB pen drive.


Hi.

I cannot re-format a corrupted USB pen drive.

I've tried gnome-disk-utilty and gparted with no joy.

I've also tried this:
Code:
sudo umount /dev/sdf
Code:
sudo mkfs.vfat /dev/sdf -I
What other methods are there to use? Is it possible that a USB pen drive can become unusable?

Thanks.

Last edited by linustalman; 05-09-2016 at 10:00 AM.
 
Old 05-09-2016, 10:32 AM   #2
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,215

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Quote:
Is it possible that a USB pen drive can become unusable?
Yes, they have a life.

You can try fdisk, its command line, but not difficult to use. Try deleting the partition table. If that is corrupt, that could be the problem. See 'man fdisk' or google it. There are lots of examples of the command syntax.

If you can delete it, re-create a new partition table, and then try to format it. Formatting does not fix partition tables.

This command does not look correct. You format a partition, not the whole device. The command should look like 'sudo mkfs.vfat /dev/sdf1 -I' if its the first partition on the USB stick.
 
Old 05-09-2016, 10:33 AM   #3
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,140

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
Does it mount? What error messages are you getting?

These things can fail. It's usually mechanical, I'm told. If the plug is able to flex as you push it in and pull it out, eventually the connections between that and the board can break.
 
Old 05-09-2016, 12:35 PM   #4
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Hi camorri & DavidMcCann.

I should have added that all this happened after I tried to slow erase the pen drive in gnome-disk-utilty (I'd already done the same on a few pen drives already without issue). I think the erase hung and I forced quit the program.
Attached is the current image of it in gnome-disk-utility -- although there seems to be a /dev/sdf1 also according to gparted and the terminal.

Yes, it mounts and the files are there but they are no openable - I suppose due to partial formating before?
When I right click in Caja file manager and select 'Safely remove' -- I get this error message when pulling the pen drive out of the USB port.
"Unable to stop Kingston DataTraveler 2.0
Error opening /dev/sdf: No such file or directory"

I get no error is I select 'eject' in Caja.
Attached Thumbnails
Click image for larger version

Name:	disks.png
Views:	23
Size:	23.1 KB
ID:	21721  

Last edited by linustalman; 05-09-2016 at 12:37 PM.
 
Old 05-09-2016, 01:28 PM   #5
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,215

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
Could you try and check the file system? There are options to attempt to repair a broken file system. Here is a link with examples.

-->http://www.thegeekstuff.com/2012/08/...mand-examples/

Best of luck.
 
Old 05-09-2016, 01:39 PM   #6
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Post

Quote:
Originally Posted by camorri View Post
Could you try and check the file system? There are options to attempt to repair a broken file system. Here is a link with examples.

-->http://www.thegeekstuff.com/2012/08/...mand-examples/

Best of luck.
Hi Cliff.
Code:
$ sudo parted /dev/sdb 'print'
[sudo] password for roy: 
Model: Kingston DataTraveler 2.0 (scsi)
Disk /dev/sdb: 31.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  31.0GB  31.0GB  primary  fat32        lba
Edit: Also this:
Code:
$ sudo parted /dev/sdb1 'print'
Model: Unknown (unknown)
Disk /dev/sdb1: 31.0GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  31.0GB  31.0GB  fat32

Last edited by linustalman; 05-09-2016 at 01:42 PM.
 
Old 05-09-2016, 03:19 PM   #7
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Unhappy

I've tried loads of methods over hours but have hit a brick wall.
 
Old 05-09-2016, 03:51 PM   #8
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
First thing I would try, delete all partitions on the pen drive using gparted. Then create a new partition on the pen drive and format using gparted. Your partition table is probably messed up. You attempted to format sdf instead of sdf1 which would have put a file system on the raw block device, sdf,instead of on the existing partition, sdf1. By deleting all existing partitions on the pen drive and starting over with a new partition and format, you can probably fix things.

If that doesn't work, you can try zero filling the entire drive with:
Code:
sudo dd if=/dev/zero of=/dev/sdx
where you should replace "sdx" with the appropriate device file for your pen drive. It appears to be "sdf" from your prior posts but make doubly sure you have the right device file. After doing this you will have to repartition and format the drive.
 
Old 05-09-2016, 04:15 PM   #9
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 616

Rep: Reputation: 142Reputation: 142
Did you try to create ntfs or ext filesystem?
Did you try to erase partition table and re-create it and create new partition?
Check pen drive for bad blocks with badblocks utility. If you have Windows installed there are HDDScan utility for Windows that has a nice GUI, can test (read/write/verify) the drive.
 
Old 05-09-2016, 05:14 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
It may be that the maker of the device has some software that may recover it. It is possible that others software may work too. HP used to have a program that fixed a few. Might even try just putting syslinux on it. That has fixed one of mine before.
 
Old 05-10-2016, 07:57 AM   #11
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Unhappy

I now get this [image attached] when I try to mount the USB drive.
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2016-05-10 11:07:36.png
Views:	35
Size:	34.2 KB
ID:	21732  
 
Old 05-10-2016, 07:59 AM   #12
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by kilgoretrout View Post
First thing I would try, delete all partitions on the pen drive using gparted. Then create a new partition on the pen drive and format using gparted. Your partition table is probably messed up. You attempted to format sdf instead of sdf1 which would have put a file system on the raw block device, sdf,instead of on the existing partition, sdf1. By deleting all existing partitions on the pen drive and starting over with a new partition and format, you can probably fix things.

If that doesn't work, you can try zero filling the entire drive with:
Code:
sudo dd if=/dev/zero of=/dev/sdx
where you should replace "sdx" with the appropriate device file for your pen drive. It appears to be "sdf" from your prior posts but make doubly sure you have the right device file. After doing this you will have to repartition and format the drive.
Hi kilgoretrout.

Whenever I try gparted, it hangs when I try to do anything with the USB drive. It changed from sdb to sdf -- I was selecting the correct drive alright. I tried the dd commands but it also just hangs.
 
Old 05-10-2016, 08:03 AM   #13
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Unhappy

Quote:
Originally Posted by Teufel View Post
Did you try to create ntfs or ext filesystem?
Did you try to erase partition table and re-create it and create new partition?
Check pen drive for bad blocks with badblocks utility. If you have Windows installed there are HDDScan utility for Windows that has a nice GUI, can test (read/write/verify) the drive.
Hi Teufel.

It was FAT32.

I tried HDDScan to erase the drive but it did nothing.

I tried with: sudo badblocks -v /dev/sdf -- but it hangs.
 
Old 05-10-2016, 08:35 AM   #14
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
please wait, give some time to complete (even an hour or more).
 
Old 05-10-2016, 08:38 AM   #15
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,715

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by pan64 View Post
please wait, give some time to complete (even an hour or more).
Hi pan64.

For which method/command?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to format a Pen Drive (with USB live image) ? kishor joshi Linux - Newbie 2 07-30-2013 07:50 AM
[SOLVED] USB pen drive format jjonas Linux - Hardware 3 01-15-2012 01:25 PM
Best filesystem to format USB pen drive with to be usable from Windows, Mac, Linux? veeruk101 Linux - Newbie 1 11-04-2011 02:39 PM
[SOLVED] Trying to format Pen drive to ext 3 Tony_photoplus Linux - General 3 01-24-2011 06:39 AM
Software required for recovering data from corrupted pen drive shakes82 Linux - Software 2 07-09-2010 06:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration