LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 01-01-2008, 05:36 PM   #1
leisa
LQ Newbie
 
Registered: Jan 2008
Location: The World Wide Web
Distribution: Ubuntu 10.04
Posts: 5

Rep: Reputation: 0
Cannot write to USB flash drive


This isn't a Linux issue as much as one of a hardware nature but I am looking for a Linux-related solution (I don't run Windows at all).

I have a USB flash drive that can't be written to. I can mount the drive (apparently) and I can copy the one and only file on it but I can't write to it at all. This includes repartitioning or reformatting.

fdisk -l output is very strange:

Quote:
leisa@laptop:~$ fdisk -l /dev/sdb

Disk /dev/sdb: 4288 MB, 4288676352 bytes
132 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 8184 * 512 = 4190208 bytes
Disk identifier: 0x6f20736b

This doesn't look like a partition table
Probably you selected the wrong device.

Device Boot Start End Blocks Id System
/dev/sdb1 ? 95081 234561 570754815+ 72 Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(357, 116, 40) logical=(95080, 19, 11)
Partition 1 has different physical/logical endings:
phys=(357, 32, 45) logical=(234560, 104, 51)
Partition 1 does not end on cylinder boundary.
/dev/sdb2 ? 20613 257175 968014120 65 Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(288, 115, 43) logical=(20612, 14, 47)
Partition 2 has different physical/logical endings:
phys=(367, 114, 50) logical=(257174, 92, 42)
Partition 2 does not end on cylinder boundary.
/dev/sdb3 ? 228481 465043 968014096 79 Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(366, 32, 33) logical=(228480, 18, 30)
Partition 3 has different physical/logical endings:
phys=(357, 32, 43) logical=(465042, 95, 39)
Partition 3 does not end on cylinder boundary.
/dev/sdb4 ? 352601 352608 27749+ d Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(372, 97, 50) logical=(352600, 44, 25)
Partition 4 has different physical/logical endings:
phys=(0, 10, 0) logical=(352607, 15, 33)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
leisa@laptop:~$
I don't care about the data on this device. I only want to be able to use the damned thing.

Any suggestions?
 
Old 01-01-2008, 06:42 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
1. Try running dosfsck on it.

2. Reformat it with mkdosfs.
 
Old 01-01-2008, 06:55 PM   #3
leisa
LQ Newbie
 
Registered: Jan 2008
Location: The World Wide Web
Distribution: Ubuntu 10.04
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David the H. View Post
1. Try running dosfsck on it.
Tried that yesterday. While it found all sorts of errors, it refused to correct them.

Quote:
2. Reformat it with mkdosfs.
Hadn't tried that as I didn't expect it to work. Tried it just now as you suggested...and it didn't do a thing.

Edit: Just to add, mkdosfs believed that the device was full. Actually, there is one 30MB zip file on this 4GB drive.

Last edited by leisa; 01-01-2008 at 07:01 PM. Reason: Additional info
 
Old 01-01-2008, 07:18 PM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Then it's probably a corrupted partition table or something. Try recreating the partition with fdisk (or cfdisk, etc), then reformatting. You might also try zeroing the thing out with dd first.

If that doesn't work, it could be a hardware problem.
 
Old 01-01-2008, 07:42 PM   #5
leisa
LQ Newbie
 
Registered: Jan 2008
Location: The World Wide Web
Distribution: Ubuntu 10.04
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks David.

Unfortunately, fdisk (and cfdisk) won't write anything to this thing. In the case of cfdisk:

Quote:
FATAL ERROR: Bad primary partition 0: Partition begins after end-of-disk
Press any key to exit cfdisk
I'ts looking like it's probably a hardware issue. Too bad. This thing is only about 3 weeks old.

I occasionally use these flash drives for temporary backup purposes. Now I'm not so sure that they're reliable enough even for that.

Oh well. Thanks to all for the help. I suspect I'll just put it out of its misery. Any suggestions? Boot? Hammer? 12 gauge?
 
Old 01-01-2008, 09:29 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
I mentioned trying to zero the thing out using the dd command; that is, erase the device by filling it up with zero-bits. It's probably only necessary to wipe out the partition table that lies in the first sector or so.

dd if=/dev/zero of=/dev/sdb bs=512 count=1

Be very careful you get the right device name, dd isn't nicknamed "data destroyer" for nothing. I know from personal experience.

Once you have the device zeroed, you should be able to go back in and repartition it. Assuming it's not a hardware problem, of course.

As for your comment about using the drive for backup, I'm sure they're generally quite reliable. But the FAT filesystem isn't. If you plan only to use the drive as a linux backup device, you might consider formatting it in ext3 instead.

Also be aware that flash memory devices are capable of only a limited number of write-erase cycles before the memory blocks in them start to become unusable, so try not to stress them too much.
 
Old 01-01-2008, 10:30 PM   #7
leisa
LQ Newbie
 
Registered: Jan 2008
Location: The World Wide Web
Distribution: Ubuntu 10.04
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David the H. View Post
I mentioned trying to zero the thing out using the dd command
Nope. DD didn't work...but you DID give me an idea using another method of zeroing out the drive.

I'll let you know (it's taking quite a while).
 
Old 01-02-2008, 09:30 AM   #8
leisa
LQ Newbie
 
Registered: Jan 2008
Location: The World Wide Web
Distribution: Ubuntu 10.04
Posts: 5

Original Poster
Rep: Reputation: 0
Update:

This device is dead. Nothing will write to it. 'dd' command did nothing, 'badblocks' actually appeared to be doing something as it went on and on for about 11 hours but did nothing except to give my cpu fan a workout.

I'm giving up!

The end. Thanks anyway, DtH.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Cannot write to a USB flash disk yiux Linux - Hardware 2 04-29-2007 11:33 PM
Can't format USB flash drive, write protection krisbitner Linux - Hardware 5 02-07-2007 03:18 PM
How to write files immediately to flash drive. adds2one Linux - Hardware 7 10-06-2006 12:13 AM
Flash drive write cache ilikejam Linux - Hardware 5 05-22-2004 11:07 AM
USB Flash drive will not let me write. sniperhf Linux - Hardware 1 12-05-2003 02:39 AM


All times are GMT -5. The time now is 09:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration