]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
mkfs: move 'mounted' check before 'existing fs' check
authorJan Tulak <jtulak@redhat.com>
Tue, 9 Oct 2018 16:49:47 +0000 (11:49 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 9 Oct 2018 16:49:47 +0000 (11:49 -0500)
commitcb46aab2d1172a27184f9204ecc1ffb8cdedaa8e
treeb69fdf76fcebe742532a1e1eb5fd66ad197db2ce
parent915a27a05b19017b478a9c2e356126373022847d
mkfs: move 'mounted' check before 'existing fs' check

Check if a device is mounted (and issue an error about that) before
asking for -f flag.

Example of the old behaviour I'm changing:
$ mkfs.xfs /dev/sda1
mkfs.xfs: /dev/sda1 appears to contain an existing filesystem (xfs).
mkfs.xfs: Use the -f option to force overwrite.

$ mkfs.xfs -f /dev/sda1
mkfs.xfs: /dev/sda1 contains a mounted filesystem

Signed-off-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/xfs_mkfs.c