summaryrefslogtreecommitdiff
path: root/usr/src/man/man1m/ntfsclone.1m
blob: a288e018fe914a39ba495f571bf4107beecc1161 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
'\" te
.\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright (c) 2002-2006 Szabolcs Szakacsits
.\" Copyright (c) 2002-2005 Anton Altaparmakov
.\" Copyright (c) 2002-2003 Richard Russon
.\" Copyright (c) 2007 Yura Pakhuchiy
.\" This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License, or (at your option) any later version.  This program is distributed
.\" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with this program
.\" (in the main directory of the Linux-NTFS distribution in the file COPYING);  if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 11-1307 USA
.TH NTFSCLONE 1M "May 14, 2009"
.SH NAME
ntfsclone \- clone, image, restore, or rescue an NTFS
.SH SYNOPSIS
.LP
.nf
\fBntfsclone\fR [\fIoptions\fR] \fIsource\fR
.fi

.LP
.nf
\fBntfsclone\fR \fB--save-image\fR [\fIoptions\fR] \fIsource\fR
.fi

.LP
.nf
\fBntfsclone\fR \fB--resotore-image\fR [\fIoptions\fR] \fIsource\fR
.fi

.LP
.nf
\fBntfsclone\fR \fB--metadata\fR [\fIoptions\fR] \fIsource\fR
.fi

.SH DESCRIPTION
.sp
.LP
The \fBntfsclone\fR utility efficiently clones (which includes copy, save,
backup, and restore operations) or rescues an NTFS filesystem to a sparse file,
an image, a device (partition), or to standard output. It works at disk sector
level and copies only the written data (that is, not empty space). Unused disk
space becomes zero (cloning to sparse file), encoded with control codes (saving
in special image format), left unchanged (cloning to a disk/partition) or
filled with zeros (cloning to standard output).
.sp
.LP
\fBntfsclone\fR can be useful in making backups\(emtaking an exact snapshot of
an NTFS filesystem\(emand restoring it later on. It also can be used to test
NTFS read/write functionality and allows you to troubleshoot users' issues
using the clone, without the risk of destroying the original file system.
.sp
.LP
If not using the special image format (see section of the same name below), the
clone is an exact copy of the original NTFS file system, from sector to sector.
Thus, it can also be mounted just like the original NTFS filesystem. For
example, if you clone to a file and the kernel has a loopback device and NTFS
support, then the file can be mounted using:
.sp
.in +2
.nf
# \fBmount -t ntfs -o loop ntfsclone.img\fR
.fi
.in -2
.sp

.SS "Windows Cloning"
.sp
.LP
You must exercise great care to copy, move or restore a system or boot
partition  to  another computer, or to a different disk or partition (for
example, \fB/dev/dsk/c0d0p1\fR to \fB/dev/dsk/c0d0p2\fR, \fB/dev/dsk/c0d0p1\fR
to \fB/dev/dsk/c0d1p1\fR or to a different disk sector offset).
.sp
.LP
Under most circumstances, to enable Windows to boot you must copy, move, or
restore NTFS to the same partition that has the following characteristics as
the original partition and disk:
.RS +4
.TP
.ie t \(bu
.el o
starts at the same sector
.RE
.RS +4
.TP
.ie t \(bu
.el o
on the same type of disk
.RE
.RS +4
.TP
.ie t \(bu
.el o
having the same BIOS legacy cylinder setting
.RE
.sp
.LP
The \fBntfsclone\fR utility guarantees an exact copy of NTFS but does not deal
with booting issues. This is by design: \fBntfsclone\fR is a file system, not a
system, utility. Its goal is only NTFS cloning, not Windows cloning. Because of
this, \fBntfsclone\fR can be used as a very fast and reliable building block
for Windows cloning, but is not a complete answer. You can find useful tips on
NTFS cloning at the NTFS web site, http://wiki.linux-ntfs.org\&.
.SS "Sparse Files"
.sp
.LP
A file containing unallocated blocks (holes) is referred to as a "sparse file".
The reported size of such files is always higher than the disk space consumed
by them. The \fBdu\fR(1) command reports the real disk space used by a sparse
file. The holes are always read as zeros. All major Linux file systems, such
as, \fBext2\fR, \fBext3\fR, \fBreiserfs\fR, \fBReiser4\fR, JFS, and XFS support
sparse files. However, the ISO 9600 CD-ROM file system, as one example, does
not.
.SS "Special Image Format"
.sp
.LP
It is recommended that you save an NTFS filesystem to a special image format.
Instead of representing unallocated blocks as holes, they are encoded using
control codes. Thus, the image saves space without requiring sparse file
support. The image format is ideal for streaming file system images over the
network. The disadvantage of the special image format is that you cannot mount
the image directly; you must first restore it.
.sp
.LP
To save an image using the special image format, use the  \fB-s\fR or  the
\fB--save-image\fR option. To restore an image, use the \fB-r\fR or the
\fB--restore-image\fR option. Note that you can restore images from  standard
input by using a hyphen (\fB-\fR) as the source file.
.SS "Metadata-only Cloning"
.sp
.LP
Using the \fB-m\fR or \fB--metadata\fR option, \fBntfsclone\fR can save only
the NTFS metadata and the clone still will be mountable. In this usage, all
non-metadata file content is lost; reading back the data results in all zeros.
.sp
.LP
The metadata-only image can be compressed very well, usually to a size in the
range of 1 to 8 MB. It is convenient to transfer such an image for
investigation and troubleshooting.
.sp
.LP
In metadata-only mode, \fBntfsclone\fR saves none of the user's data, which
includes the resident user's data embedded into metadata. All is filled with
zeros. Moreover, all the file timestamps, and deleted and unused spaces inside
the metadata are filled with zeros. Thus, this mode is inappropriate, for
example, for forensic analyses.
.sp
.LP
Note that filenames are not removed. Because a filename might contain sensitive
information, consider the possibities for breaches of security or privacy
before sending out a metadata-only image.
.SH OPTIONS
.sp
.LP
Supported options are listed below. Most options have both single-letter and
full-name forms. Multiple single-letter options that do not take an argument
can be combined. For example, \fB-fv\fR is the equivalent of \fB-f\fR \fB-v\fR.
A full-name option can be abbreviated to a unique prefix of its name.
.sp
.ne 2
.na
\fB\fB-f\fR, \fB--force\fR\fR
.ad
.sp .6
.RS 4n
Forces \fBntfsclone\fR to proceed, even if the filesystem is marked "dirty"
following a consistency check.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR, \fB--help\fR\fR
.ad
.sp .6
.RS 4n
Show a list of options with a brief description of each one.
.RE

.sp
.ne 2
.na
\fB\fB-i\fR, \fB--ignore-fs-check\fR\fR
.ad
.sp .6
.RS 4n
Ignore the result of the file system consistency check. This option can be used
only with the \fB--meta-data\fR option. Any clusters that cause an
inconsistency are saved.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR, \fB--metadata\fR\fR
.ad
.sp .6
.RS 4n
Clone only metadata. With this option, you must clone only to a file.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR, \fB--output\fR \fIfile\fR\fR
.ad
.sp .6
.RS 4n
Clone NTFS to the non-existent \fIfile\fR. If \fIfile\fR is a hyphen (\fB-\fR),
clone to the standard output.
.RE

.sp
.ne 2
.na
\fB\fB-O\fR, \fB--overwrite\fR \fIfile\fR\fR
.ad
.sp .6
.RS 4n
Clone NTFS to \fIfile\fR, overwriting \fIfile\fR if it already exists.
.RE

.sp
.ne 2
.na
\fB\fB--rescue\fR\fR
.ad
.sp .6
.RS 4n
Ignore disk read errors so that a disk having bad sectors, for example, a
failing disk, can be rescued with minimal impact on the disk. \fBntfsclone\fR
works at the lowest, sector level in this mode, enabling more data to be
rescued. The contents of the unreadable sectors are filled with the question
mark (\fB?\fR) character; the beginning of such sectors are marked by the
string: \fBBadSector\fR.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR, \fB--restore-image\fR \fIsource\fR\fR
.ad
.sp .6
.RS 4n
Restore from the special image format specified by \fIsource\fR. If
\fIsource\fR is a hyphen (\fB-\fR), the image is read from the standard input.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR, \fB--save-image\fR\fR
.ad
.sp .6
.RS 4n
Save to the special image format. In terms of space usage and speed, this is
the most efficient option if imaging is done to the standard output. This
option is useful for image compression, encryption, or streaming through a
network.
.RE

.SH EXAMPLES
.LP
\fBExample 1 \fRCloning with Overwrite Option
.sp
.LP
The following command clones with the \fB--overwrite\fR option.

.sp
.in +2
.nf
# \fBntfsclone --overwrite /dev/dsk/c0d2p1 /dev/dsk/c0d0p1\fR
.fi
.in -2
.sp

.LP
\fBExample 2 \fRSaving to Special Image Format
.sp
.LP
The following command clones to the special image format to its original
partition.

.sp
.in +2
.nf
# \fBntfsclone --save-image --output backup.img /dev/dsk/c0d0p1\fR
.fi
.in -2
.sp

.LP
\fBExample 3 \fRRestoring from a Special Image File
.sp
.LP
The following command restores an NTFS from a special image file.

.sp
.in +2
.nf
# \fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 backup.img\fR
.fi
.in -2
.sp

.LP
\fBExample 4 \fRSaving to a Compressed Image
.sp
.LP
The following command saves an NTFS to a compressed image file.

.sp
.in +2
.nf
# \fBntfsclone --save-image -o - /dev/dsk/c0d0p1\fR
.fi
.in -2
.sp

.LP
\fBExample 5 \fRRestoring from a Compressed Image
.sp
.LP
The following command restores an NTFS volume from a compressed image file.

.sp
.in +2
.nf
# \fBgunzip -c backup.img.gz | \e\fR
\fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
.fi
.in -2
.sp

.LP
\fBExample 6 \fRBacking up to a Remote Host Using \fBssh\fR
.sp
.LP
The following command backs up to a remote host, using \fBssh\fR(1). Note that
\fBssh\fR will probably require a password.

.sp
.in +2
.nf
# \fBntfsclone --save-image --output - /dev/dsk/c0d0p1 | \e\fR
\fBgzip -c | ssh host `cat > backup.img.gz`\fR
.fi
.in -2
.sp

.LP
\fBExample 7 \fRRestoring from a Remote Host Using \fBssh\fR
.sp
.LP
The following command backs up to a remote host, using \fBssh\fR(1). Note that
\fBssh\fR will probably require a password.

.sp
.in +2
.nf
# \fBssh host `cat backup.img.gz` | gunzip -c  | \e\fR
\fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
.fi
.in -2
.sp

.LP
\fBExample 8 \fRStreaming an Image File from a Web Server
.sp
.LP
The following command streams an image file from a web server and restore it to
a partition.

.sp
.in +2
.nf
# \fBwget -qO - http://server/backup.img | \e\fR
\fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
.fi
.in -2
.sp

.LP
\fBExample 9 \fRCloning to a New File
.sp
.LP
The following command clones an NTFS volume to a non-existent file.

.sp
.in +2
.nf
# \fBntfsclone --output ntfs-clone.img /dev/dsk/c0d0p1\fR
.fi
.in -2
.sp

.LP
\fBExample 10 \fRPacking NTFS Metadata
.sp
.LP
The following command packs NTFS metadata into an image file. Note that
\fBbzip2\fR takes a much longer time than \fBgzip\fR, but produces an archive
that is up to ten times smaller than the latter produces.

.sp
.in +2
.nf
# \fBntfsclone --metadata --output ntfsmeta.img /dev/dsk/c0d0p1\fR
\fBbzip2 ntfsmeta.img\fR
.fi
.in -2
.sp

.LP
\fBExample 11 \fRUnpacking NTFS Metadata
.sp
.LP
The following command unpacks NTFS metadata into a sparse file.

.sp
.in +2
.nf
# \fBbunzip2 -c ntfsmeta.img.bz2 | \e\fR
\fBcp --sparse=always /proc/self/fd/0 ntfsmeta.img\fR
.fi
.in -2
.sp

.SH EXIT STATUS
.sp
.LP
The return code is zero on success, non-zero otherwise.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Uncommitted
.TE

.SH SEE ALSO
.sp
.LP
\fBdu\fR(1), \fBssh\fR(1), \fBntfsresize\fR(1M), \fBntfsundelete\fR(1M),
\fBparted\fR(1M), \fBattributes\fR(5)
.sp
.LP
http://wiki.linux-ntfs.org
.SH AUTHORS
.sp
.LP
\fBntfsclone\fR was written by Szabolcs Szakacsits with contributions from Per
Olofsson (special image format support) and Anton Altaparmakov.