# USB flash drive Issue

## mmoscosa

Hello! Well, I hope this is the right place to post this.

I have a USB flash drive (512MB) and I was copying from a computer to another compter, but suddenly, I got this error saying my USB was write prottected

this is funny since the USB has no physical swith to protect it

I tried doing fdisk /dev/sda and tried to delete the partition and to make a new partition but it didnt let me

I tried formatting in other OS and the same thing   :Confused: 

doeas anyone knows a way of how to force the usb to formet or to erase everything so i can write in it again?

tank you very much in advance

----------

## Ma3oxuct

How old is that drive and how many times would you say that you wrote to it in its history?

If you say great amount then your drive has unfortunatly been used up to its threshhold. Flash drives have a limited number of writes that you can do to them (this includes deleting, formating, and overwriting).

----------

## mmoscosa

wow!! didnt knew that!!!

My usb is about 1year old and I really dont know how many times have i wrote, erased,etc

but i guess, I have Fulled up my usb and deleted it less than 50 times

and I believe I have formatted around less than 5 times

Is that enough ?!

----------

## Ma3oxuct

I could very well be enough. Some people have had thiers die within ten overwrites. I think it all boils down to the quality of the flash drives. The higher quality flash drives should last for about 100-150 overwrites.

----------

## BlackEdder

What does dmesg show?

For my usbdrive ehci mode (usb2) doesn't seem to work on this computer (works fine on others)  and it will stop transferring suddenly. I always rmmod ehci_hcd before using the drive. This forces it to work in usb1 mode, which is slow, but works.

----------

## afabbro

 *Ma3oxuct wrote:*   

> How old is that drive and how many times would you say that you wrote to it in its history?
> 
> If you say great amount then your drive has unfortunatly been used up to its threshhold. Flash drives have a limited number of writes that you can do to them (this includes deleting, formating, and overwriting).

 

Do you have a source for this statement?  I've been trying to find some information on this and can't locate anything.  Unless you mean "like every other piece of electronics eventually flash drives wear out"...but I think you're saying that the number of writes is known and/or at a low ("limited") number.

----------

## mmbrothers

This is an quote from wikipedia

 *Quote:*   

> Like all flash memory devices, flash drives can sustain only a limited number of write/erase cycles before failure. In normal use, mid-range flash drives currently on the market will support several million cycles, although write operations will gradually slow as the device ages. This should be a consideration when using a flash drive as a hard drive to run application software or an operating system. To address this (and the space limitations common on flash drives), some developers have produced versions of operating systems (such as Linux) or commonplace applications (such as Mozilla Firefox) designed to run from flash drives. These are typically optimized for size and set up so as to place temporary or intermediate files in memory rather than nonvolatile storage (to avoid excessive writing to the flash memory in the flash drive).

 

http://en.wikipedia.org/wiki/USB_Flash_Drive

----------

## mmbrothers

Some USB drives can have read-only flags that are set in software.  Try to find out if the flag is set by

```

hdparm -r /dev/XXXX

```

If it is set then you can turn it off with

```

hdparm -r 0 /dev/XXXX

```

----------

## mmbrothers

Did this fix it for you?

----------

## mmoscosa

I am on holiday hehehhe   :Embarassed:  but as soon as I can get next to my PC I will try it thx in advance, I will reply ASAP

----------

## pjp

Moved from Other Things Gentoo

----------

## mmoscosa

unfortunatelly the tip that mmbrothers didnt work... 

I havent wrote in the usb millions of times.. whichs makes this case weird, dont you think so?!

----------

## Decibels

Have you tried

```
dd if=/dev/zero of=/dev/sda

cfdisk /dev/sda
```

----------

## mmoscosa

I get:

 *Quote:*   

> 
> 
> dd: opening '/dev/sda' : Read-only file system
> 
> 

 

 :Confused:   :Confused:   :Confused:   :Confused: 

----------

## Decibels

I had a bad flash drive, sent it back and when tried to put DSL on the new one, something got screwed up and couldn't

do anything with it either. 

Problem is I don't remember what I did to fix it exactly. Probably something around.

Try 'testdisk' and see if can fix it.

Try 'sfdisk' and then might be able to use fdisk or cfdisk after.

Burn an iso of DamnSmallLinux and see if that script can erase it. 

Mmmm, can't remember. Kinda went into automatic mode on that sucker and got it. Try the two above and

maybe I or someone else will think of something else.

Could try the Damn Small Linux and burn it to CD, then try to install it on the flash drive. That script seemed to work pretty good.

Better than throwing it away.

----------

