Page 1 of 2

format a usb stick

Posted: 5. Oct 2015, 23:09
by jsfarinet
I've a problem with a usb stick i formatted long time ago as multiboot (under debian). Now,for some reason this stick is not recognized anymore.Not even by cfdisk, parted or gparted. 'udisks --enumerate shows it,on the other hand. I'm pretty it is broken softwarewise not hardwarewise

I tried to format it on a macintosh, but it did not show up there anyway (and i'm not really familiar with macos ;) ).

Is there some tool, i could use to override the mbr and the corrupted boot sector, so that it will turn back formattable?

TIA!

Re: format a usb stick

Posted: 6. Oct 2015, 09:33
by gapan
Post the output of

Code: Select all

sudo fdisk -l
before and after you insert the usb stick.

Also post the last lines of

Code: Select all

sudo dmesg
after you insert the usb stick.

Re: format a usb stick

Posted: 6. Oct 2015, 10:50
by jsfarinet

Code: Select all

sudo fdisk -l
only shows the internal hd (sda).

Code: Select all

sudo fdisk -l /dev/sdc
shows this:

Code: Select all

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.


Platte /dev/sdc: 773 MByte, 773652480 Byte
15 Köpfe, 48 Sektoren/Spur, 2098 Zylinder, zusammen 1511040 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sdc1   *          63     1511039      755488+  83  Linux

Code: Select all

sudo parted
and then select /dev/sdc > print shows:

Code: Select all

Warnung: /dev/sdc enthält GPT-Signaturen, die anzeigen, dass es eine GPT-Tabelle
hat. Es ist jedoch keine gültige vorgetäuschte MSDOS-Partitionstabelle
vorhanden, die erforderlich wäre. Vielleicht wurde diese zerstört -- eventuell
durch ein Programm, das GPT-Partitionstabellen nicht versteht. Oder vielleicht
haben Sie die GPT-Tabelle gelöscht, und verwenden jetzt eine
MS-DOS-Partitions-Tabelle. Ist dies eine GPT-Partitionstabelle?
Ja/Yes/Nein/No? y                                                         
Modell:  (file)
Festplatte  /dev/sdc:  774MB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: gpt
Disk Flags: pmbr_boot

Nummer  Anfang  Ende    Größe  Dateisystem  Name     Flags
 1      2163kB  2969kB  806kB               recover  boot
If i reply no to the question if it is a gpt partition table the i get:

Code: Select all

Modell:  (file)
Festplatte  /dev/sdc:  774MB
Sektorgröße (logisch/physisch): 512B/512B
Partitionstabelle: unknown
Disk Flags: 
sudo dmesg | grep usb
shows this:

Code: Select all

[22597.728391] usb 3-1: new high-speed USB device number 8 using ehci-pci
[22597.843649] usb 3-1: New USB device found, idVendor=048d, idProduct=1168
[22597.843658] usb 3-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[22597.845013] usb-storage 3-1:1.0: USB Mass Storage device detected
[22597.845143] scsi12 : usb-storage 3-1:1.0
It is a 16gig mistral made by CnMemory.

Re: format a usb stick

Posted: 6. Oct 2015, 10:57
by gapan
Try:

Code: Select all

sudo parted /dev/sdc
mklabel msdos
quit
What does

Code: Select all

sudo fdisk -l
show then?

Oh, and it's generally a good idea to

Code: Select all

export LANG=en_US.utf8
when asking for help online. Not everyone understands german. ;)

Re: format a usb stick

Posted: 6. Oct 2015, 12:17
by jsfarinet
Thanks for your patience. Where should i put the command to export in English?

In any case unfortunately the mklabel msdos command did not change anything. In fdisk -l the stick still does not show up. In fdisk /dev/sdc -l it shows up as before, i.e. in very distorted way ...

In gparted it does not show up at all. May be it's an idea to force a copy by using dd. And then, even if the copy went wrong may be i turns back to be formattable???

Re: format a usb stick

Posted: 6. Oct 2015, 12:30
by gapan
You can run the export command in the terminal, before you run anything else.

Anyway, you can overwrite the entire stick using dd:

Code: Select all

sudo dd if=/dev/zero of=/dev/sdc
That will certainly do it. You will probably have to remove it and replug it to see the changes. You will have to repartition and format it then.

Re: format a usb stick

Posted: 8. Oct 2015, 07:36
by jsfarinet
gapan wrote:You can run the export command in the terminal, before you run anything else.

Anyway, you can overwrite the entire stick using dd:

Code: Select all

sudo dd if=/dev/zero of=/dev/sdc
That will certainly do it. You will probably have to remove it and replug it to see the changes. You will have to repartition and format it then.
That changed something but still i do not see the stick in gparted. I also tried u3-tools but seems they're too old ... (?)

In any case thanks to you for your patience. May be you've another idea (???)

Re: format a usb stick

Posted: 8. Oct 2015, 08:25
by gapan
Post the output of

Code: Select all

sudo fdisk -l
now.

And I'm quite sure that running

Code: Select all

sudo cfdisk /dev/sdc
or

Code: Select all

sudo fdisk /dev/sdc
will allow you to partition it from scratch now.

Re: format a usb stick

Posted: 8. Oct 2015, 10:15
by jsfarinet
gapan wrote:Post the output of

Code: Select all

sudo fdisk -l
now.

Code: Select all

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 Köpfe, 63 Sektoren/Spur, 60801 Zylinder, zusammen 976773168 Sektoren
Einheiten = Sektoren von 1 × 512 = 512 Bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00073e7b

   Gerät  boot.     Anfang        Ende     Blöcke   Id  System
/dev/sda1   *          63    58589054    29294496   83  Linux
Partition 1 does not start on physical sector boundary.
/dev/sda2        58589055   960927974   451169460   83  Linux
Partition 2 does not start on physical sector boundary.
/dev/sda3       960927975   976773167     7922596+  82  Linux Swap
Partition 3 does not start on physical sector boundary.
gapan wrote:And I'm quite sure that running

Code: Select all

sudo cfdisk /dev/sdc
Wenn i do this, eg. i create a primary table, bootable, ecc ecc. *IN* cfdisk the result looks like this:

Code: Select all

 cfdisk (util-linux 2.21.2)

                              Festplatte: /dev/sdc
                       Größe: 3860926464 Bytes, 3860 MB
              Köpfe: 102   Sektoren pro Spur: 24   Zylinder: 3080

    Name        Flags      Part. Typ  Dateisystemtyp   [Bezeichner]  Größe (MB)
 ------------------------------------------------------------------------------
                            Pri/Log   Freier Bereich                       0,04*
    sdc1        Boot        Primäre   W95 FAT32                         3860,90*










     [  Hilfe   ]  [   Neue   ]  [ Ausgabe  ]  [   Ende   ]  [ Einheit. ]
     [ Schreib. ]
but fdisk -l gives the same result as before :clueless:
gapan wrote:or

Code: Select all

sudo fdisk /dev/sdc
will allow you to partition it from scratch now.
It seems to work too, but to the same extend as cfdisk.

Note that in any case the given available content of the stick clearly is wrong: it *IS* defintely a 16G stick (and not 4G).

Thunar tries to mount it (and shows a device, but it's not accessable). When i try to eject, i get this error msg, which may says something to you:

Code: Select all

Error ejecting /dev/sdc: Command-line `eject "/dev/sdc"' exited with non-zero exit status 1: eject: tried to use `/dev/sdc' as device name but it is no block device
eject: tried to use `.//dev/sdc' as device name but it is no block device
eject: unable to find or open device for: `/dev/sdc'
Eventually, although i do not think so, is there something i could/should do in "etc/fstab" ?

Re: format a usb stick

Posted: 9. Oct 2015, 19:48
by maximus
jsfarinet wrote: Eventually, although i do not think so, is there something i could/should do in "etc/fstab" ?
I don't think so either.

After all of this, can you see the stick at all in gparted now? I did come across a USB stick recently that was used as installation media for Ubuntu, and was formatted with GPT partitions. I was able to select the device in the drop-down menu in gparted, then choose Device --> Create Partition Table from the main menu, which removed all details of the existing partitions, and let me then create a single partition which filled the whole drive.

To be honest, I think the advice you've already received should have fixed any problems related to a screwed up filesystem; I would certainly expect zeroing the drive using dd to have done so. Of course I may be wrong, but if you still can't access the drive now then I think you're looking at faulty hardware.