1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
.\" Copyright 2009 by Karel Zak. All Rights Reserved.
.\" This file may be copied under the terms of the GNU Public License.
.\"
.TH WIPEFS 8 "December 2014" "util-linux" "System Administration"
.SH NAME
wipefs \- wipe a signature from a device
.SH SYNOPSIS
.B wipefs
.RB [ options ]
.IR device ...
.sp
.B wipefs
.RB [ \-\-backup ]
.B \-o
.I offset
.IR device ...
.sp
.B wipefs
.RB [ \-\-backup ]
.B \-a
.IR device ...
.SH DESCRIPTION
.B wipefs
can erase filesystem, raid or partition-table signatures (magic strings) from
the specified
.I device
to make the signatures invisible for libblkid.
.B wipefs
does not erase the filesystem itself nor any other data from the device.
When used without any options, wipefs lists all visible filesystems and the
offsets of their basic signatures. The default output is subject to change.
So whenever possible, you should avoid using default outputs in your scripts.
Always explicitly define expected columns by using
.B \-\-output
.I columns-list
in environments where a stable output is required.
.B wipefs
calls the BLKRRPART ioctl when it has erased a partition-table signature
to inform the kernel about the change. The ioctl is called as the last step
and when all specified signatures from all specified devices are already erased.
This feature can be used to wipe content on partitions devices as well as partition
table on a disk device, for example by \fBwipefs \-a /dev/sdc1 /dev/sdc2 /dev/sdc\fR.
Note that some filesystems and some partition tables store more magic strings on
the device (e.g., FAT, ZFS, GPT). The
.B wipefs
command (since v2.31) lists all the offset where a magic strings have been
detected.
When option \fB\-a\fR is used, all magic strings that are visible for libblkid are
erased. In this case the
.B wipefs
scans the device again after each modification (erase) until no magic string is found.
Note that by default
.B wipefs
does not erase nested partition tables on non-whole disk devices.
For this the option \fB\-\-force\fR is required.
.SH OPTIONS
.TP
.BR \-a , " \-\-all"
Erase all available signatures. The set of erased signatures can be
restricted with the \fB\-t\fR option.
.TP
.BR \-b , " \-\-backup"
Create a signature backup to the file $HOME/wipefs-<devname>-<offset>.bak.
For more details see the \fBEXAMPLE\fR section.
.TP
.BR \-f , " \-\-force"
Force erasure, even if the filesystem is mounted. This is required in
order to erase a partition-table signature on a block device.
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.TP
.BR \-J , " \-\-json"
Use JSON output format.
.TP
\fB\-\-lock\fR[=\fImode\fR]
Use exclusive BSD lock for device or file it operates. The optional argument
\fImode\fP can be \fByes\fR, \fBno\fR (or 1 and 0) or \fBnonblock\fR. If the \fImode\fR
argument is omitted, it defaults to \fB"yes"\fR. This option overwrites
environment variable \fB$LOCK_BLOCK_DEVICE\fR. The default is not to use any
lock at all, but it's recommended to avoid collisions with udevd or other
tools.
.TP
.BR \-i , " \-\-noheadings"
Do not print a header line.
.TP
.BR \-O , " \-\-output " \fIlist\fP
Specify which output columns to print. Use \-\-help to
get a list of all supported columns.
.TP
.BR \-n , " \-\-no\-act"
Causes everything to be done except for the write() call.
.TP
.BR \-o , " \-\-offset " \fIoffset\fP
Specify the location (in bytes) of the signature which should be erased from the
device. The \fIoffset\fR number may include a "0x" prefix; then the number will be
interpreted as a hex value. It is possible to specify multiple \fB\-o\fR options.
.sp
The \fIoffset\fR argument may be followed by the multiplicative
suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
(the "iB" is optional, e.g., "K" has the same meaning as "KiB"), or the suffixes
KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
.TP
.BR \-p , " \-\-parsable"
Print out in parsable instead of printable format. Encode all potentially unsafe
characters of a string to the corresponding hex value prefixed by '\\x'.
.TP
.BR \-q , " \-\-quiet"
Suppress any messages after a successful signature wipe.
.TP
.BR \-t , " \-\-types " \fIlist\fP
Limit the set of printed or erased signatures. More than one type may
be specified in a comma-separated list. The list or individual types
can be prefixed with 'no' to specify the types on which no action should be
taken. For more details see mount(8).
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.SH ENVIRONMENT
.IP LIBBLKID_DEBUG=all
enables libblkid debug output.
.IP LOCK_BLOCK_DEVICE=<mode>
use exclusive BSD lock. The mode is "1" or "0". See \fB\-\-lock\fR for more details.
.SH EXAMPLE
.TP
.B wipefs /dev/sda*
Prints information about sda and all partitions on sda.
.TP
.B wipefs \-\-all \-\-backup /dev/sdb
Erases all signatures from the device /dev/sdb and creates a signature backup
file ~/wipefs-sdb-<offset>.bak for each signature.
.TP
.B dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb seek=$((0x00000438)) bs=1 conv=notrunc
Restores an ext2 signature from the backup file ~/wipefs-sdb-0x00000438.bak.
.SH AUTHORS
Karel Zak <kzak@redhat.com>
.SH SEE ALSO
.BR blkid (8),
.BR findfs (8)
.SH AVAILABILITY
The wipefs command is part of the util-linux package and is available from
https://www.kernel.org/pub/linux/utils/util-linux/.
|