btrfs-progs: require mkfs -f force option to overwrite filesystem or partition table
authorEric Sandeen <sandeen@redhat.com>
Thu, 14 Feb 2013 18:30:03 +0000 (12:30 -0600)
committerDavid Sterba <dsterba@suse.cz>
Tue, 19 Feb 2013 10:15:31 +0000 (11:15 +0100)
commit2a2d8e1962e8b6cda7b0a7584f6d2fb95d442cb6
treebaf0bcadc48c146e25717f1506ab46edbb8194ad
parent3b85739dd6c63c8f94f87d6574494919d2c1119f
btrfs-progs: require mkfs -f force option to overwrite filesystem or partition table

The core of this is shamelessly stolen from xfsprogs.

Use blkid to detect an existing filesystem or partition
table on any of the target devices.  If something is found,
require the '-f' option to overwrite it, hopefully avoiding
disaster due to mistyped devicenames, etc.

# mkfs.btrfs /dev/sda1

WARNING! - Btrfs v0.20-rc1-59-gd00279c-dirty IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using

/dev/sda1 appears to contain an existing filesystem (xfs).
Use the -f option to force overwrite.
#

This does introduce a requirement on libblkid.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Makefile
man/mkfs.btrfs.8.in
mkfs.c