Explanation bug in mkfs xfs Filesystem mkfs from util-linux 2.26.2
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| util-linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bug Description
mkfs from util-linux 2.26.2
during an exercise with creating xfs partitions on a Ubuntu 15.10 64 Bit virtual machine,
I guess I found a bug.
Explanation:
When creating an xfs filesystem on a partition with a existing gpt table, the mkfs command return an error message
with the advice to force the command to run by using the -f option (lowercase f)
However, it wont work and as you can see at my bash text, the command tells me that -f (lowercase f) is an invalid option.
I read the manpages of mkfs to determine what should be the correct option. Even here, the -f (lowercase f) is mentioned.
-f Force overwrite when an existing filesystem is detected on the device. By default, mkfs.xfs will not write to the device if it suspects that there is a filesystem or partition table on the device already.
So I tried the uppercase F (-F) to FORCE the command to overwrite everything which worked !
So there are 2 possibilities:
#1 I am to dump to use a -f properly
#2 The texts (man pages and stderr)are wrong written and should be replaced with a uppercase F.
root@ubuntu:/mnt# mkfs -t xfs /dev/sdb2
mkfs.xfs: /dev/sdb2 appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.
root@ubuntu:/mnt# mkfs -tf xfs /dev/sdb2
mkfs: failed to execute mkfs.f: No such file or directory
root@ubuntu:/mnt# mkfs -t -f xfs /dev/sdb2
mkfs: failed to execute mkfs.-f: No such file or directory
root@ubuntu:/mnt# mkfs -f -t xfs /dev/sdb2
mkfs.ext2: invalid option -- 'f'
root@ubuntu:/mnt# mkfs -F -t xfs /dev/sdb2
mke2fs 1.42.12 (29-Aug-2014)
Found a gpt partition table in /dev/sdb2
Your mke2fs.conf file does not define the xfs filesystem type.
Creating filesystem with 512000 1k blocks and 128016 inodes
Filesystem UUID: 216b73d3-
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
Please give a feedback if my observation is correct or wrong.
With best regards
Stephan H. Wenderlich

Your confusion is due to the difference between mkfs and mkfs.xfs. The latter wants you to pass it the -f, but to the former, this is an invalid option. The -f must follow the -t xfs so that mkfs does not interpret it and only passes it to mkfs.xfs.