Confused about command line options for Linux mkfs
I am formatting a new drive on Ubuntu 20.04, and I am at the step where I format the drive to ext4. One article (https://linuxize.com/post/fdisk-command-in-linux/) says to do this:
sudo mkfs.ext4 -F /dev/sdb1
The article doesn’t say what the -F option is, and there is no -F option in the Linux man page for mkfs at https://man7.org/linux/man-pages/man8/mkfs.8.html.
Another article (https://www.digitalocean.com/community/tutorials/how-to-partition-and-format-storage-devices-in-linux) says to use the -L option:
sudo mkfs.ext4 -L datapartition /dev/sda1
but again it doesn’t say what -L does.
Another article (https://linuxhandbook.com/mkfs-command/) said to use the -t option
sudo mkfs -t ext4 /dev/sdb
-t is listed on the Linux man page with this: "Specify the type of filesystem to be built. If not specified, the default filesystem type (currently ext2) is used." I don’t want ext2, I want ext4.
So my question is: do I want to choose -F, -L or -t? Where can I find an explanation of those other command line options shown above that are not covered in the Linux man page for mkfs?
You need to read the correct manpage with
man mkfs.ext4 or online where these options are explained:
-F Force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. In order to force mke2fs to create a filesystem even if the filesystem appears to be in use or is mounted (a truly dangerous thing to do), this option must be specified twice. -L new-volume-label Set the volume label for the filesystem to new-volume-label. The maximum length of the volume label is 16 bytes. -t fs-type Specify the filesystem type (i.e., ext2, ext3, ext4, etc.) that is to be created. If this option is not specified, mke2fs will pick a default either via how the command was run (for example, using a name of the form mkfs.ext2, mkfs.ext3, etc.) or via a default as defined by the /etc/mke2fs.conf(5) file. This option controls which filesystem options are used by default, based on the fstypes configuration stanza in /etc/mke2fs.conf(5).