I used my USB drive to create a bootable Linux installer, and now I want to return it to a normal storage drive. The USB was advertised as 124 GB, but the file manager shows only about 3 GB and says it is full. The partition manager shows a 31 GB device with a Linux swap filesystem, and I cannot format it. What is the safest way to restore the drive to its full capacity?
2 Answers
In the partition manager, select the correct USB device, delete its existing partitions, create a new partition table—GPT is a good choice—and then create one new partition using all available space. Format that partition afterward. Be extremely careful to select the USB and not another disk.
If the drive is genuinely showing the wrong capacity, tools such as GParted or KDE Partition Manager can write a new partition table. You can also use commands like `wipefs --all /dev/sdX` followed by `parted /dev/sdX --script mklabel gpt`, but only after confirming the device name because this erases everything on the selected drive. In this case, though, the capacity issue came from selecting the wrong device.

I eventually realized the 31 GB device was actually my RAM, not the USB drive. The flash drive was listed directly above it, so I had been looking at the wrong device.