From: Karel Zak Date: Thu, 18 Feb 2016 11:57:13 +0000 (+0100) Subject: sfdisk: add --wipe X-Git-Tag: v2.28-rc1~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15b5e942f2c159db8f726079573bb77cdad560ed;p=thirdparty%2Futil-linux.git sfdisk: add --wipe This patch changes sfdisk behavior and it wipes foreign signatures from the device to avoid collisions. The wipe functionality is automatically enabled in the interactive mode only (user is always warned about it), otherwise it's possible to control all by --wipe . The program does not change behavior when executed in scripts (echo | sfdisk), the option "--wipe=always" is required to enable in this case. Signed-off-by: Karel Zak --- diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8 index 31b43c2c91..1e60de5190 100644 --- a/disk-utils/sfdisk.8 +++ b/disk-utils/sfdisk.8 @@ -208,6 +208,17 @@ is no label on the device yet, then the type defaults to \fBdos\fR. .BR \-Y , " \-\-label\-nested " \fItype Force editing of a nested disk label. The primary disk label has to exist already. This option allows to edit for example a hybrid/protective MBR on devices with GPT. + +.TP +.BR -w , " \-\-wipe "\fImode +Wipe filesystems, RAIDs and partition tables signatures from the device, in +order to avoid possible collisions. The \fImode\fR can be \fBauto\fR, +\fBnever\fR or \fBalways\fR. The default is \fBauto\fR, in this case signatures +are wiped in the interactive mode only, in all cases detected signatures are +reported by warning message before a new partition table is created. See also +.BR wipefs (8) +command. + .TP .BR \-v , " \-\-version" Display version information and exit. diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index 4e99df53b8..81371eb347 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -89,6 +89,7 @@ enum { struct sfdisk { int act; /* ACT_* */ int partno; /* -N , default -1 */ + int wipemode; /* remove foreign signatures */ const char *label; /* --label