Is it ok to mkfs without partition number?
Creating a filesystem on a whole disk rather than a partition is possible, but unusual. The documentation only explicitly mentions the partition because that's the most usual case (it does say usually). You can create a filesystem on anything that acts sufficiently like a fixed-size file, i.e. something where if you write data at a certain location and read back from the same location then you get back the same data. This includes whole disks, disk partitions, and other kinds of block devices, as well as regular files (disk images).
After doing mkfs.fat -n A /dev/sdb
, you no longer have a partition on that disk. Beware that the kernel still thinks that the disk has a partition, because it keeps the partition table cached in memory. But you shouldn't try to use /dev/sdb1
anymore, since it no longer exists; writing to it would corrupt the filesystem you created on /dev/sdb
since /dev/sdb1
is a part of /dev/sdb
(everything except a few hundred bytes at the beginning). Run the command partprobe
as root to tell the kernel to re-read the partition table.
While creating a filesystem on a whole disk is possible, I don't recommend it. Some operating systems may have problems with it (I think Windows would cope but some devices such as cameras might not), and you lose the possibility of creating other partitions. See also The merits of a partitionless filesystem
It is generally fine to put a filesystem on a whole device, rather
than partitioning and formatting the partitions, if you do not intend
to have more than one filesystem on your device. You will simply have
to be consistent; since your put the filesystem on sda
rather than
sda1
, you will have to mount sda
as well, since sda1
will not
exist at all.
The device in your question appears to be a FAT-formatted removable drive: if it is going to be used with embedded devices that may have a more or less detailed notion of how filesystems can be mounted, it may be worth testing that they do in fact support a whole-device filesystem without a partition table. (For example, cameras tend to create a single partition and format that; it's entirely possible that they would declare a partitionless memory card unusable.)