-
Notifications
You must be signed in to change notification settings - Fork 5
/
diskrescue.8
162 lines (162 loc) · 4.7 KB
/
diskrescue.8
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
.\" $diskrescue$
.\"
.\" Copyright (c) 2009 Marco Peereboom <[email protected]>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt DISKRESCUE 1
.Os
.Sh NAME
.Nm diskrescue
.Nd disk recovery tool
.Sh SYNOPSIS
.Nm
.Bk -words
.Op Fl aqv
.Op Fl R Ar results file
.Op Fl b Ar block size
.Op Fl i Ar in file
.Op Fl o Ar out file
.Op Fl r Ar raw device
.Ar operation
.Ek
.Sh DESCRIPTION
.Nm
is a tool to verify, recover and restore as much data as possible from failed
disks.
.Pp
The idea is to read all sectors of a disk and let the disk reallocate bad
or soon to be bad sectors.
While the disk is being read it can clone the data to a file or a disk as well.
The resulting disk/file can be checked with
.Xr fsck 8
and analyzed with
.Xr dumpfs 8
and
.Xr fsdb 8
while not having to deal with a failing disk.
.Pp
When a sector can not be read it will be filled with zeroes and
.Nm
continues on to the next sector.
.Pp
Alternatively,
.Nm
can also restore an image onto a disk or other file.
.Pp
For all intents and purposes this is a fancy
.Xr dd 1
that takes some of the complexity out of dealing with a failed disk.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl R Ar results file
Write the results of the rescue process to the specified file.
If the results file already exists the program will attempt to restart
the recovery.
Other parameters such as
.Fa block size
and
.Fa out file
can not be specified when attempting to restart a recovery.
.It Fl a
Abort on read error.
.It Fl b Ar block size
This is the block size that the disk uses to read and write data.
A large value speeds things up and once a bad spot on the disk is hit
.Nm
reverts to the natural block size of 512 bytes during the recovery process.
Default is 512, which is very slow!
The argument accepts the following quantifiers: b, k, m, g and the following
multipliers: * and x.
For example 1 mega byte can be expressed as: -b 1m or -b 1k*1k
.It Fl i Ar in file
This is the source file for the restore operation.
One can not use raw device as the
.Fa in file
; use the recover operation and the
.Fa raw disk
parameter instead.
.It Fl o Ar out file or disk
This is the target file or disk of the operation.
.It Fl q
Don't report completion percentage.
.It Fl r Ar raw disk
This is the raw disk device that will be attempted to be recovered.
For example: /dev/rsd2c
.It Fl v
Print version number and exit.
.It Ar operation
.Bl -tag -width Ds -offset indent -compact
.It Cm verify
The verify operation reads the entire disk and lets it do its thing to
reallocate bad or questionable blocks.
This operation can not be resumed if aborted.
.It Cm recover
Essentially the same as verify but write the read data to a file or disk.
This operation can be resumed if aborted provided there is a valid
.Fa results
file.
.It Cm restore
Restore an image file to a disk or file.
Restore can not be used to copy a raw device to a disk or file.
This operation can not be resumed if aborted.
.El
.El
.Pp
.Sh SEE ALSO
.Xr dd 1
.Xr fsck 8
.Xr dumpfs 8
.Xr fsdb 8
.Sh HISTORY
.Nm
was written to recover a disk of a friend and it became useful enough for
the general public.
.Sh AUTHORS
.An -nosplit
.Pp
.Nm
was written by
.An Marco Peereboom Aq [email protected] .
.Sh EXAMPLES
Verify a disk and force it to reallocate bad blocks:
.Bd -literal -offset indent
diskrescue -b 1m -r /dev/rsd2c verify
.Ed
.Pp
Recover a disk to a file and write a results file:
.Bd -literal -offset indent
diskrescue -r /dev/rsd2c -R res -o disk.img -b 1m recover
.Ed
.Pp
Restart a recovery operation with a results file:
.Bd -literal -offset indent
diskrescue -r /dev/rsd2c -R res recover
.Ed
.Pp
Restore an image to a disk:
.Bd -literal -offset indent
diskrescue -b 1m -i disk.img -o /dev/rsd2c restore
.Ed
.Pp
.Sh DISCLAIMER
Use this at your own risk!
Recovering disks can make them worse and the author takes no responsibility
for any data loss or corruption.
Also when used wrong a good disk could be overwritten permanently losing
all data on it.
Use this tool wisely and leave the author alone if you mess up.
.Sh BUGS
Lots of features are still missing.