0

I'm quite confused about the different format types a USB stick could have (or for that matter, any storage device). On this USB stick, I used to have a distro iso installed, and wanted to make it back into a "normal" USB stick. However, I realized I don't really understand this so much, and wanted to stop shooting in the dark.

I removed the iso installation with the following:

sudo wipefs /dev/sdb

sudo wipefs -a /dev/sdb

Then I did the following (believing the following was the "default" format to go to) (from here):

sudo parted /dev/sdb
(parted) mklabel msdos
(parted) mkpart primary ext4 1MiB 100%

But I was not able to mount it afterwards:

sudo mount /dev/sdb /run/media/usb

As it gave me this error:

mount: /run/media/usb: wrong fs type, bad option, bad superblock on /dev/sdb, missing codepage or helper program, or other error.

Still here, if I run lsblk the device shows up, but I can't mount, and if I plug-and-unplug the USB back in, it doesn't show up in the file navigator (whatever you call it... mine is thunar).

I was shooting in the dark as it was, but I feel there is a lot I don't understand (in particular, what each formatting of the USB stick does, when to use a particular format, etc.). I would appreciate any pointers to relevant material to read about, but also a quick solution to the following problem would be great in the meantime: how do I make the USB stick "normal" again, so that I can store stuff on it like a standard USB stick?

2
  • 1
    Welcome, sdX is not the partition, is the device. You mount partitions, which are the numbers in the device name: sdXY, for example: sdb1. So the command would be sudo mount /dev/sdb1 /run/media/usb. Commented Jan 27, 2021 at 20:55
  • /run/media/usb is just a directory I make to mount usb sticks to - I have another stick with files on it I can mount to it with a similar command as above. If i try sudo mount /dev/sdb1 /run/media/usb I get the same error as before
    – Chris
    Commented Jan 27, 2021 at 20:58

3 Answers 3

1

You just reset the partition table, you don't have a filesystem there. You need to run mkfs on the partition to do it:

mkfs -tvfat /dev/sdb1

Note that you want to create the filesystem on the partition (sdb1), not the whole disk (sdb without numbers).

Also, you may want to check the partition type as marked in the partition table, Windows systems may dislike the stick if it has a partition marked as a Linux partition. Looking at the man page, I'm not sure if parted allows to change the type of an existing partition, but mkpart primary fat32 1MiB 100% seems to work.

0

The question "what do you mean by normal" is the crucial one. My Mac seems to "like" quite a different disks than my Linux. Embedded machines in my work are very different to both...

E. g. "normal small flash disk" (MBR partition and VFAT filesystem):

  1. First you need to create a partition, with a proper type. Run sudo cfisk /dev/sdb and create a new partition over all the disk space. Set type to 0c and save.

  2. Then you need to put a proper filesystem on it. sudo mkfs.vfat /dev/sdb1 should do the trick.

0

The storage devices need to be formatted to be able to store information. Formatting implies creating a file system. There are many, but we can mention FAT, NTFS --both Windows formats--, and EXT that are usually used by linux systems.

Once formatted the disk is able store information. The formatting includes making partitions, that in Linux naming are the numbers attached to the name of the device, for example sda1, sdb2, etc. These partitions are the ones the OS mounts at a mountpoint, where you can access the information.

I think this is what you mean as "normal".

With this in mind we can explain a little your command mkpart primary ext4, you are telling parted to create a partition (primary) with the file system format EXT4.

You don't need a particular format (file system), unless you know which one can be read by different OSs or devices. For example Windows doesn't read any format but its own, FAT and NTFS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .