How to recover a USB stick after Ubuntu installation?

24,223

Solution 1

here's some simple instructions just for your reference.

A. First we need to delete the old partitions that remain on the USB key.

Open a terminal and type sudo su
Type fdisk -l and note your USB drive letter.
Type fdisk /dev/sdx (replacing x with your drive letter)
Type d to proceed to delete a partition
Type 1 to select the 1st partition and press enter
Type d to proceed to delete another partition (fdisk should automatically select the second partition)

B. Next we need to create the new partition.

Type n to make a new partition
Type p to make this partition primary and press enter
Type 1 to make this the first partition and then press enter
Press enter to accept the default first cylinder
Press enter again to accept the default last cylinder
Type w to write the new partition information to the USB key
Type umount /dev/sdx1 (replacing x with your drive letter)

C. The last step is to create the fat filesystem.

Type mkfs.vfat -F 32 /dev/sdx1 (replacing x with your USB key drive letter)

That's it, you should now have a restored USB key with a single fat 32 partition that can be read from any computer.

Solution 2

While this may be less optimal for some right after installing Linux. The easiest fix I've found is formatting the USB on Windows.

If it doesn't Appear tap Start > Right Click Computer > Disk (or device) Manager > Carefully delete all the USB partitions then format the new partition.

Share:
24,223

Related videos on Youtube

Torinouq
Author by

Torinouq

Updated on September 18, 2022

Comments

  • Torinouq
    Torinouq over 1 year

    I have created a liveUSB-stick with Xubuntu 12.04 on it. I installed Xubuntu from it on a MacBook Air. If I now plug in the usb stick, it is not recognized anymore. How can I make it recognized and format it in order to use it again as a normal storage USB stick?

    • Admin
      Admin almost 12 years
      Plug it in and format it.
    • Admin
      Admin almost 12 years
      If you are using Linux, try the command "dmesg". It will show you whether the device has been detected or not.
    • Admin
      Admin almost 12 years
      okay, I saw with dmesg that /dev/sdc has 2 GB, so I guess that's my USB stick. I then tried sudo mkfs -t vfat /dev/sdc and obtained: "Device partition expected, not making filesystem on entire device '/dev/sdc' (use -I to override)". What am I doing wrong?
    • Admin
      Admin almost 12 years
      Yes, I saw sdc1 as well. I used that, so mkfs worked. But afterwards, the USB stick was still not visible. I then used fdisk as suggested by vicd below, that worked
  • Torinouq
    Torinouq almost 12 years
    Thanks vicd for the details, exactly what I was looking for. I indeed now see the USB stick again :-) It has the strange name D4C4-DD6D. How (or where) could I have specified a normal name like "USB"?
  • vicd
    vicd almost 12 years
    Glad to hear you've solved this issue. To label your usb stick, feel free to use -n option, if you want to specify a name like "USB", try this command mkfs.vfat -F 32 -n USB /dev/sdx1
  • vicd
    vicd almost 12 years
    In addtion, you can get this done easily by using "Gparted Partion Editor"(default installed in ubuntu), that's a GUI way without re-formating it :-) The ONLY thing you need to pay attention is to unmount your usb stick before renaming it.