Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

USB drive is in read only state and I can't repair it.

First of all I tried erase it using dd:

root@yurko-laptop:/home/yurko-laptop# ls -l /dev/disk/by-id | grep usb
lrwxrwxrwx 1 root root  9 Дек 18 23:45 usb-Generic_Flash_Disk_C173828A-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Дек 18 23:45 usb-Generic_Flash_Disk_C173828A-0:0-part1 -> ../../sdb1
root@yurko-laptop:/home/yurko-laptop# dd if=/dev/zero of=/dev/sdb
dd: запись в «/dev/sdb»: На устройстве кончилось место
8257537+0 записей считано
8257536+0 записей написано
скопировано 4227858432 байта (4,2 GB), 942,633 c, 4,5 MB/c

After that I wanted to create new filesystem using fdisk:

root@yurko-laptop:/home/yurko-laptop# fdisk /dev/sdb
You will not be able to write the partition table.

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 4227 MB, 4227858432 bytes
4 heads, 63 sectors/track, 32768 cylinders
Units = cylinders of 252 * 512 = 129024 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              18       32768     4126596    b  W95 FAT32

Command (m for help):

fdisk showed that the partition still exists and I can't write the partition table.

I tried to delete the existing partition:

Command (m for help): d
Selected partition 1

Command (m for help): w

Unable to write /dev/sdb
root@yurko-laptop:/home/yurko-laptop# 

Why am I not be able to write the partition table?

Does it mean that some hardware failure occurred?

And is it possible to repair the current USB drive?

I've tried to use hdparm and it showed that the readonly flag is on:

root@yurko-laptop:/home/yurko-laptop# hdparm /dev/sdb

/dev/sdb:
SG_IO: bad/missing sense data, sb[]:  f0 00 05 00 00 00 00 0a 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 multcount     =  0 (off)
 readonly      =  1 (on)
 readahead     = 256 (on)
 geometry      = 1016/131/62, sectors = 8257536, start = 0
share|improve this question

migrated from stackoverflow.com Dec 19 '12 at 0:49

This question came from our site for professional and enthusiast programmers.

    
Is it possible this drive is old enough or has had enough use that it is out of write cycles? A drive will effectively become read-only at that point as well. –  mikebabcock Dec 19 '12 at 3:32
    
I think yes. In fact it is not my usb and I don't know details about using. I just tried to repair it. –  yurko Dec 19 '12 at 8:44
add comment

1 Answer

up vote 1 down vote accepted

I found a useful thread. They ran hdparm -r0 /dev/sdb to try to force the r/w on the drive.

If that fails, I'd try plugging the usb device in while running gparted. You could see if gparted throws any errors about the drive.

share|improve this answer
    
Unfortunately it didn't help. hdparm had no any effect. I tried plug in the usb while gparted running, but I didn't see any changes. I also tried run 'gparted /dev/sdb', but gparted said "Could not stat device /dev/sdb". Now fdisk also don't see this usb, so it seems it is time to buy new drive. But thank you. –  yurko Dec 20 '12 at 19:41
    
In my case using hdparm had no effect, but after it I've changed USB-port and did hdparm again and stick was recovered. Thanks for solution! –  petRUShka Jun 29 at 13:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.