LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Messed up usb key (http://www.linuxquestions.org/questions/linux-hardware-18/messed-up-usb-key-770413/)

bluesmanu 11-20-2009 06:43 AM

Messed up usb key
 
Hi all,

it seems I screwed up my usb key while trying to make it bootable. I think i copied a .img file to /dev/sdb instead of /dev/sdb1 and now I cannot access or format the key.
When I plug it in I get
Code:

[  129.088311] usb 2-3: new high speed USB device using ehci_hcd and address 3
[  129.221235] usb 2-3: configuration #1 chosen from 1 choice
[  129.324495] Initializing USB Mass Storage driver...
[  129.325056] scsi6 : SCSI emulation for USB Mass Storage devices
[  129.325448] usbcore: registered new interface driver usb-storage
[  129.325452] USB Mass Storage support registered.
[  129.325454] usb-storage: device found at 3
[  129.325456] usb-storage: waiting for device to settle before scanning
[  134.325717] usb-storage: device scan complete
[  134.326425] scsi 6:0:0:0: Direct-Access    USBest  USB2FlashStorage 0.00 PQ: 0 ANSI: 2
[  134.327266] sd 6:0:0:0: Attached scsi generic sg2 type 0
[  134.328820] sd 6:0:0:0: [sdb] Attached SCSI removable disk

The disk used to be recognized as "Ut165 USB2FlashStorage" and now it's "USBest USB2FlashStorage"

Here's also what i get :

Code:

[root]$ fdisk /dev/sdb
Unable to open /dev/sdb
[root]$ sfdisk /dev/sdb
/dev/sdb: No medium found
sfdisk: cannot open /dev/sdb read-write

Please help!
Thx!

linus72 11-20-2009 06:52 AM

Try dd'ing the usb, and recreating the partition table with Gparted

plug in USB and open a root terminal

Code:

dd if=/dev/zero of=/dev/sdb bs=512 count=1
make sure you dont dd your hd!
the above will wipe the usb completely
make sure usb is sdb

after dd'ing it
remove usb, wait ten sec
reinsert usb and open gparted
you can open gparted on the usb from root terminal

Code:

gparted /dev/sdb
then right-click on usb line and select
"new" and it will say it needs to make a msdos table
do that
then format and set boot flag of usb

thats how I fix my usb(s) when something really goes bad

bluesmanu 11-20-2009 07:29 AM

Thank you for your reply. I tried dd :
Code:

[root]$ dd if=/dev/zero of=/dev/sdb bs=512 count=1
dd: opening `/dev/sdb': No medium found

I am almost certain the key is sdb since in dmesg I see :
Code:

[ 4547.595645] sd 10:0:0:0: [sdb] Attached SCSI removable disk

linus72 11-20-2009 07:34 AM

what does

fdisk -l

show ?

bluesmanu 11-20-2009 07:45 AM

It does not show the sdb device
Code:

[root]$ fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x68000000

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        3647    29294496  83  Linux
/dev/sda2            3648      19457  126993825    5  Extended
/dev/sda5            3648        3890    1951866  82  Linux swap / Solaris
/dev/sda6            3891      19457  125041896  83  Linux


linus72 11-20-2009 08:10 AM

you know I think its already been dd'd and thats why it cant see it?

can Gparted see the usb?

bluesmanu 11-20-2009 08:34 AM

no it does not :
Code:

gparted /dev/sdb
======================
libparted : 1.8.8.1.159-1e0e
======================
Error opening /dev/sdb: No medium found


dimitrisdad 07-24-2011 10:10 PM

stack of messed up usb keys
 
I've now got three USB keys with the same problem as the original poster.

They all have the same history. I originally used dd to put an install live image on the stick. This worked, and I installed linux on a few machines from the usb. In all cases the image was much smaller than the capacity of the stick. I then wanted to use the stick at greater capacity for data again, so I ran mke2fs /dev/sdb1 and put a file system on it. In each case this appeared to work, until the stick was placed in another machine. Then there was the dreaded "no medium found"

For example, for this disk, mount, fdisk, gpart, and dd all give the message "medium not found". However lsusb shows the drive device, as does the tail of /var/log/messages. ls /dev/disk/by-id shows the drive "usb-USBest_USB2FlashStorage-0:0" but when I mount or fdisk /dev/disk/by-id/usb-USBest_USB2FlashStorage-0:0" it says medium not found.

Yes, a new USB stick does work fine on the same computer. .. I suppose until I use it to install a system again ...

ptdsign 04-18-2012 04:34 PM

Have you tried the utility testdisk? It fixed one of my sticks after breaking it by dd-ing to the device and its hfs partition with boot flag...

dimitrisdad 04-18-2012 11:32 PM

testdisk
 
# testdisk /dev/disk/by-id/usb-USBest_USB2FlashStorage-0:0
TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Unable to open file or device /dev/disk/by-id/usb-USBest_USB2FlashStorage-0:0


All times are GMT -5. The time now is 03:00 PM.