summaryrefslogtreecommitdiffstats
path: root/misc-utils/wipefs.8
blob: baf4602811aea84ebf25386d0fa377bce3fa361c (plain)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
'\" t
.\"     Title: wipefs
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.15
.\"      Date: 2022-05-11
.\"    Manual: System Administration
.\"    Source: util-linux 2.38.1
.\"  Language: English
.\"
.TH "WIPEFS" "8" "2022-05-11" "util\-linux 2.38.1" "System Administration"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
wipefs \- wipe a signature from a device
.SH "SYNOPSIS"
.sp
\fBwipefs\fP [options] \fIdevice\fP...
.sp
\fBwipefs\fP [\fB\-\-backup\fP] \fB\-o\fP \fIoffset device\fP...
.sp
\fBwipefs\fP [\fB\-\-backup\fP] \fB\-a\fP \fIdevice\fP...
.SH "DESCRIPTION"
.sp
\fBwipefs\fP can erase filesystem, raid or partition\-table signatures (magic strings) from the specified \fIdevice\fP to make the signatures invisible for libblkid. \fBwipefs\fP does not erase the filesystem itself nor any other data from the device.
.sp
When used without any options, \fBwipefs\fP 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 \fB\-\-output\fP \fIcolumns\-list\fP in environments where a stable output is required.
.sp
\fBwipefs\fP calls the \fBBLKRRPART\fP 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\fP.
.sp
Note that some filesystems and some partition tables store more magic strings on the device (e.g., FAT, ZFS, GPT). The \fBwipefs\fP command (since v2.31) lists all the offset where a magic strings have been detected.
.sp
When option \fB\-a\fP is used, all magic strings that are visible for \fBlibblkid\fP(3) are erased. In this case the \fBwipefs\fP scans the device again after each modification (erase) until no magic string is found.
.sp
Note that by default \fBwipefs\fP does not erase nested partition tables on non\-whole disk devices. For this the option \fB\-\-force\fP is required.
.SH "OPTIONS"
.sp
\fB\-a\fP, \fB\-\-all\fP
.RS 4
Erase all available signatures. The set of erased signatures can be restricted with the \fB\-t\fP option.
.RE
.sp
\fB\-b\fP, \fB\-\-backup\fP
.RS 4
Create a signature backup to the file \fI$HOME/wipefs\-<devname>\-<offset>.bak\fP. For more details see the \fBEXAMPLE\fP section.
.RE
.sp
\fB\-f\fP, \fB\-\-force\fP
.RS 4
Force erasure, even if the filesystem is mounted. This is required in order to erase a partition\-table signature on a block device.
.RE
.sp
\fB\-J\fP, \fB\-\-json\fP
.RS 4
Use JSON output format.
.RE
.sp
\fB\-\-lock\fP[=\fImode\fP]
.RS 4
Use exclusive BSD lock for device or file it operates. The optional argument \fImode\fP can be \fByes\fP, \fBno\fP (or 1 and 0) or \fBnonblock\fP. If the \fImode\fP argument is omitted, it defaults to \fB"yes"\fP. This option overwrites environment variable \fB$LOCK_BLOCK_DEVICE\fP. The default is not to use any lock at all, but it\(cqs recommended to avoid collisions with udevd or other tools.
.RE
.sp
\fB\-i\fP, \fB\-\-noheadings\fP
.RS 4
Do not print a header line.
.RE
.sp
\fB\-O\fP, \fB\-\-output\fP \fIlist\fP
.RS 4
Specify which output columns to print. Use \fB\-\-help\fP to get a list of all supported columns.
.RE
.sp
\fB\-n\fP, \fB\-\-no\-act\fP
.RS 4
Causes everything to be done except for the \fBwrite\fP(2) call.
.RE
.sp
\fB\-o\fP, \fB\-\-offset\fP \fIoffset\fP
.RS 4
Specify the location (in bytes) of the signature which should be erased from the device. The \fIoffset\fP number may include a "0x" prefix; then the number will be interpreted as a hex value. It is possible to specify multiple \fB\-o\fP options.
.sp
The \fIoffset\fP 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.
.RE
.sp
\fB\-p\fP, \fB\-\-parsable\fP
.RS 4
Print out in parsable instead of printable format. Encode all potentially unsafe characters of a string to the corresponding hex value prefixed by \(aq\(rsx\(aq.
.RE
.sp
\fB\-q\fP, \fB\-\-quiet\fP
.RS 4
Suppress any messages after a successful signature wipe.
.RE
.sp
\fB\-t\fP, \fB\-\-types\fP \fIlist\fP
.RS 4
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 \(aqno\(aq to specify the types on which no action should be taken. For more details see \fBmount\fP(8).
.RE
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Display help text and exit.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print version and exit.
.RE
.SH "ENVIRONMENT"
.sp
LIBBLKID_DEBUG=all
.RS 4
enables \fBlibblkid\fP(3) debug output.
.RE
.sp
LOCK_BLOCK_DEVICE=<mode>
.RS 4
use exclusive BSD lock. The mode is "1" or "0". See \fB\-\-lock\fP for more details.
.RE
.SH "EXAMPLES"
.sp
\fBwipefs /dev/sda\fP*
.RS 4
Prints information about sda and all partitions on sda.
.RE
.sp
\fBwipefs \-\-all \-\-backup /dev/sdb\fP
.RS 4
Erases all signatures from the device \fI/dev/sdb\fP and creates a signature backup file \fI~/wipefs\-sdb\-<offset>.bak\fP for each signature.
.RE
.sp
\fBdd if=~/wipefs\-sdb\-0x00000438.bak of=/dev/sdb seek=$((0x00000438)) bs=1 conv=notrunc\fP
.RS 4
Restores an ext2 signature from the backup file \fI~/wipefs\-sdb\-0x00000438.bak\fP.
.RE
.SH "AUTHORS"
.sp
.MTO "kzak\(atredhat.com" "Karel Zak" ""
.SH "SEE ALSO"
.sp
\fBblkid\fP(8),
\fBfindfs\fP(8)
.SH "REPORTING BUGS"
.sp
For bug reports, use the issue tracker at \c
.URL "https://github.com/util\-linux/util\-linux/issues" "" "."
.SH "AVAILABILITY"
.sp
The \fBwipefs\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."