Dave Chinner wrote:
> IOWs, it is the responsibility of the filesystem tools to correctly
> identify the filesystem being operated on, and not to
> modify/trash/recover anything unless specifically directed by the
> user. When a filesystem tool gets it wrong, then that specific tool
> needs to be fixed. i.e. it is the responsibility of filesystem
> tools to behave sanely, not for the rest of the world to have to
> work around the dangerous behaviour of a specific filesystems'
As an average Joe user, I started to agree with this, but then as a
developer I had second thoughts. It can't be right that every filesystem
tool has to have code to recognize every other type of filesystem; that
just doesn't scale. So each tool would need to call some API, which I
suppose would need to access some kernel code that iterated for every
filesystem type the kernel was configured to handle, or knew historically.
And then we have identical code in every tool, and that code is not
serving the tool's primary purpose, so maybe it should be factored out
on the one-tool-one-job philosophy. So perhaps there should be a single
tool that tells what filesystem type is present on a device, which
everybody runs before mkfs. Oh wait, df -T or other utilities already do
So I'm not sure the issue is black and white. As an average Joe, I
expect mkfs to trash whatever I give it, so I'm pretty careful to check
what is there first. And if I expected to be overwriting an existing
filesystem and I did it often enough to know about the mkfs.xfs
behaviour, I suppose I would always invoke it with the -f flag.
Consistency among the various flavours of mkfs would be nice, though.