How to repair a USB stick
How to repair a USB stick

How to repair a USB stick

Generally the main problem with USB memories is that the partition table may be corrupted or may be formatted with some non-standard file system. In short, it happened to all of us that after madly formatting a pendrive, it stopped being recognized by Windows or a DVD player. Well, here is the solution to this problem.

Repair USB sticks with GParted

The most comfortable way to repair a memory is with GParted.

To install it in Ubuntu, it would be:

sudo apt-get install gparted

Once installed, I opened gparted. Then I opened the Gparted> Devices> / dev / sdb menu. Select the drive in question, right click> Unmount.

All that remains to do is delete the current partition, create a FAT32 partition, and apply the changes.

In case of error, I accessed the Advanced Options in the same error window and select Create a partition table of type msdos. Then I repeated the process.

Once the partition is created, it must be formatted in FAT32. Finally, apply the changes.

Repair USB sticks with fdisk

We've all had problems with USB sticks (they mysteriously stop working, don't mount well, etc). This happens because normally the partition table is not correct. This is the solution to solve it by fdisk.

To detect the name of the usb device:

sudo fdisk-l

Then to repair the memory:

fdisk NAME

where NAME is the device name (ex: / Dev / sdb)

Choose o -> Clear partition table. Choose n -> Create a partition. Choose p -> This partition will be the primary one. Choose 1 -> Make it the first partition.

It will ask you for the size, if you want the partition to occupy everything, set them to the default values.

Choose t -> I chose the type of partition format. Choose c -> For FAT32. Choose w -> For the data to be written to the USB.

Finally, format the partition created as FAT32:

mkfs.vfat -F 32 NAME

where NAME is the name of the partition (ex: / dev / sdb1).

As a lesson, it seems important to note that, following the example, / Dev / sdb is the device name and / dev / sdb1 is the name of the first partition within that device, which in our case is also the only partition. If there had been more partitions on that device they would be numbered sdb2, sdb3, etc. This same logic is repeated for all your devices and partitions in Linux.
📎📎📎📎📎📎📎📎📎📎
BOT