Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My 8GB pendrive originally contained only a FAT partition, but I tried to install OpenSUSE 11.4 on it. I created a 200MB partition for /boot and the rest was for the root partition.

Despite the minimal size of basic OS installation (490MB) I got errors during install stating the rpm couldn't unpack packages (around 20% of the install process). After several such errors (which included bash rpm) I gave up, and restarted computer.

Now I have a pendrive with no partitions at all, and I am unable to create any. fdisk fails with error "fdisk: unable to read /dev/sdc: Invalid argument", gpart fails with error "Floating point exception", Windows 7 refuses to format it, and when I check the properties I see capacity 0, used 0, available 0 space, and so on.

How can I re-partition this disk?

Edit 1

dmesg output after inserting pendrive:

[ 9980.463056] usb 1-1: new high speed USB device using ehci_hcd and address 4
[ 9980.579456] usb 1-1: New USB device found, idVendor=0930, idProduct=6544
[ 9980.579460] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9980.579462] usb 1-1: Product: TransMemory
[ 9980.579464] usb 1-1: Manufacturer: TOSHIBA
[ 9980.579466] usb 1-1: SerialNumber: 000FEAFB7A60C971F3D40B8A
[ 9980.579916] scsi12 : usb-storage 1-1:1.0
[ 9981.580536] scsi 12:0:0:0: Direct-Access     GENERIC  USB Mass Storage 1.00 PQ: 0 ANSI: 2
[ 9981.580738] sd 12:0:0:0: Attached scsi generic sg2 type 0
[ 9981.585276] sd 12:0:0:0: [sdc] READ CAPACITY failed
[ 9981.585279] sd 12:0:0:0: [sdc]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9981.585283] sd 12:0:0:0: [sdc]  Sense Key : Illegal Request [current]
[ 9981.585287] sd 12:0:0:0: [sdc]  Add. Sense: Invalid command operation code
[ 9981.585766] sd 12:0:0:0: [sdc] Write Protect is off
[ 9981.585769] sd 12:0:0:0: [sdc] Mode Sense: 65 44 09 30
[ 9981.585772] sd 12:0:0:0: [sdc] Assuming drive cache: write through
[ 9981.590519] sd 12:0:0:0: [sdc] READ CAPACITY failed
[ 9981.590522] sd 12:0:0:0: [sdc]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 9981.590525] sd 12:0:0:0: [sdc]  Sense Key : Illegal Request [current]
[ 9981.590529] sd 12:0:0:0: [sdc]  Add. Sense: Invalid command operation code
[ 9981.591780] sd 12:0:0:0: [sdc] Assuming drive cache: write through
[ 9981.591783] sd 12:0:0:0: [sdc] Attached SCSI removable disk

Edit 2

Thank you for all responses. Just one clarification -- it wasn't just a try to run a distro for pendrive (however I did it before and it worked). I keep linux on pendrive just for some tests, I run it once a year maybe. But today I tried to get valid boot partition, the rest of the system was not important. But of course, if this is pendrive death case, what I wanted to do with it in future didn't matter for this poor thing :-)

share|improve this question
    
What does dmesg show when connecting the drive? Other syslog/kernel/messages? –  Caleb Aug 7 '11 at 16:45
    
@Caleb, I will update my post with the messages. What do you mean by syslog/kernel messages? –  greenoldman Aug 7 '11 at 17:42
add comment

3 Answers 3

up vote 4 down vote accepted

I would suggest that your drive experienced some kind of hardware failure. The problem isn't the partitions, the problem was encountered when the drive decided to die on you. The original errors you saw during install were probably it failing to write because the disk failed to respond correctly to commands.

You can try putting it in a different machine with a different USB controller, maybe it will come to life. If you do it will probably show the partitions as they were but with corrupted data in the one you were installing to. Unfortunately once a flash drive starts to go bad it's probably a loosing battle.

share|improve this answer
    
Thank you, I tried several computers now, no success everywhere, the pendrive died apparently. –  greenoldman Aug 8 '11 at 5:11
add comment

Unfortunately it seems that you've just killed your pendrive while trying to install a normal* distro onto it. (See wikipedia on why this is a bad idea.)

If there is any chance of bringing your pendrive back to life, it would involve destroying current partitioning. You can try doing that using dd. dd if=/dev/zero of=/dev/sdc bs=4096 count=100 should be more than enough - but remember that it will destroy your current partitions, so make sure that you want it and that /dev/sdc is the pendrive. (You can use the function recognizing external disks I posted here.)

If you are desperate to retrieve the data from the pendrive, use the testdisk tool - it might be already on your install or at least in the repos. Run it like this: testdisk /dev/sdc and proceed to Analyse and then Restore. Read the manual in case of doubt.

*) By "normal" I mean a distribution that was designed to reside on a hard drive. You should not do so - it is risky since typical distributions do not care that much about the ammount of disk writes. But your situation might indicate you were actually lucky to face this failure during installation and not after some time of system usage (see also Caleb's comment).

share|improve this answer
    
That the drive died is likely. That the action of installing a normal distro on it did this is UNLIKELY. Extended use of a normal distro on it maybe, but the guy is just trying to install the first time! The drive just died, installing a different distro wouldn't have changed it's fate. –  Caleb Aug 7 '11 at 16:50
    
It is all a matter of probability. The more writes are performed, the higher the risk. Each distro has its own install procedure that may involve more or fewer disk writes to install packages. But what i meant was mainly to indicate that there are special distributions (like Tin Hat or liveUSBs, pentoo for example) that are designed to live on a pendrive and make as little writes to it as possible. –  rozcietrzewiacz Aug 7 '11 at 17:00
    
I know of no distro that abuses disks to the point of hitting 100k write cycles on a 490MB installation. If write cycles is the reason it's failing (not certain but probable) then the disk was near-death anyway. True there are distros optimized for this use, but the OP didn't kill it just because he didn't pick one of those for FIRST INSTALLATION. He would have contributed to it's early demise by using it too much like that, but cut him some slack :) –  Caleb Aug 7 '11 at 17:07
    
@Caleb Alright. I didn't mean to blame macias too much - this stuff happens. I meant to say it was a bad idea. See also my edit (footnote) - where I tried to explain it a bit. But I know it is possible to run a system off a pendrive - I do so myself on my little home server :D (and I know it is risky, so I keep my backups). –  rozcietrzewiacz Aug 7 '11 at 17:20
    
Thank you, I don't want to restore anything, I want to create new partitions. dd didn't work -- "dd: writing `/dev/sdc': No space left on device". What strikes my odd, despite system got info it is Toshiba pendrive, it is not listed anymore as TOSxxx but as generic USB Mass Storage. Maybe it is really dead, pity :-( –  greenoldman Aug 7 '11 at 17:51
show 1 more comment

Try the application Gparted. You can either install it in Linux or use it from a LiveCD - http://gparted.sourceforge.net/

BUT be careful. It is possible to partition your Hard Drive by mistake!

share|improve this answer
    
Thank you. Unfortunatelly both GParted and QtParted do not even recognize the pendrive (the system lists it as /dev/sdc). And so I am unable to alter pendrive partition in any way. –  greenoldman Aug 7 '11 at 14:43
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.