LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Can't format USB flash drive, write protection (http://www.linuxquestions.org/questions/linux-hardware-18/cant-format-usb-flash-drive-write-protection-526383/)

krisbitner 02-07-2007 08:49 AM

Can't format USB flash drive, write protection
 
Hi all. I have a 256 MB Kingston Data Traveller. I had partitioned it into FAT32 and Linux partitions and it was working fine for quite a while. Then I lent it to someone and when I got it back it would not mount. I have tried to format using fdsik with no success, it says it cannot write to disk. It doesn't mount automatically when I plug it in and apparently the write protection is on. Formatting in XP also fails. When I use the utility in Mandriva Control Center it identifies the drive as read only and says it is empty.
This is what I get from dmesg regarding the device:

SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
Vendor: Model: USB DISK 20X Rev: 1.03
Type: Direct-Access ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 501760 512-byte hdwr sectors (257 MB)
sda: Write Protect is on
sda: Mode Sense: 23 00 80 00
sda: assuming drive cache: write through
SCSI device sda: 501760 512-byte hdwr sectors (257 MB)
sda: Write Protect is on
sda: Mode Sense: 23 00 80 00
sda: assuming drive cache: write through
/dev/scsi/host0/bus0/target0/lun0: unable to read partition table
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
Floppy drive(s): fd0 is 1.44M
floppy0: no floppy controllers found
Floppy drive(s): fd0 is 1.44M
floppy0: no floppy controllers found
Floppy drive(s): fd0 is 1.44M
floppy0: no floppy controllers found
Floppy drive(s): fd0 is 1.44M
floppy0: no floppy controllers found
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0, type 0
FAT: bogus logical sector size 65535
VFS: Can't find a valid FAT filesystem on dev sda.
FAT: bogus logical sector size 65535
VFS: Can't find a valid FAT filesystem on dev sda.
Floppy drive(s): fd0 is 1.44M
floppy0: no floppy controllers found

druuna 02-07-2007 09:43 AM

Hi,

This is probably stating the obvious, but you never know and you don't mention it: Does your USB stick have a write protect switch? 2 of my sticks have a very tiny switch (hardly noticeable) that can be used to write protect the stick.

Hope this helps.

krisbitner 02-07-2007 09:54 AM

Nope there is no mechanical write protection switch on this drive, but thanks for the suggestion.
When I try to use mkdosfs this is what I get:

/sbin/mkdosfs -F32 -v /dev/sda
mkdosfs 2.10 (22 Sep 2003)
mkdosfs: unable to open /dev/sda

tredegar 02-07-2007 11:01 AM

Quote:

/sbin/mkdosfs -F32 -v /dev/sda
mkdosfs 2.10 (22 Sep 2003)
mkdosfs: unable to open /dev/sda
You can't make a filesystem on a whole disk like that, you have to partition it first, with fdisk
Then try: /sbin/mkdosfs -F32 -v /dev/sda1

krisbitner 02-07-2007 01:58 PM

I have tried using fdisk, that is how I partitioned it originally and it worked fine. I think the main problem is that the drive is not writable so none of the changes I try to make work and I can't figure out how to fix that issue.
Here is the fdisk output when I try to create a new partition:

fdisk /dev/sda
You will not be able to write the partition table.
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. 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): p

Disk /dev/sda: 256 MB, 256901120 bytes
8 heads, 62 sectors/track, 1011 cylinders
Units = cylinders of 496 * 512 = 253952 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1011, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1011, default 1011):
Using default value 1011

Command (m for help): type
Selected partition 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): w

Unable to write /dev/sda

michaelk 02-07-2007 03:18 PM

Flash memory has a fixed number of write/erase cycles. IMO the drive just failed or was written over too many times.


All times are GMT -5. The time now is 01:17 AM.