3557 dumpvp_size is not updated correctly when a dump zvol's size is changed
[unleashed.git] / usr / src / man / man1m / ntfsclone.1m
bloba288e018fe914a39ba495f571bf4107beecc1161
1 '\" te
2 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
3 .\" Copyright (c) 2002-2006 Szabolcs Szakacsits
4 .\" Copyright (c) 2002-2005 Anton Altaparmakov
5 .\" Copyright (c) 2002-2003 Richard Russon
6 .\" Copyright (c) 2007 Yura Pakhuchiy
7 .\" 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
8 .\" 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
9 .\" (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
10 .TH NTFSCLONE 1M "May 14, 2009"
11 .SH NAME
12 ntfsclone \- clone, image, restore, or rescue an NTFS
13 .SH SYNOPSIS
14 .LP
15 .nf
16 \fBntfsclone\fR [\fIoptions\fR] \fIsource\fR
17 .fi
19 .LP
20 .nf
21 \fBntfsclone\fR \fB--save-image\fR [\fIoptions\fR] \fIsource\fR
22 .fi
24 .LP
25 .nf
26 \fBntfsclone\fR \fB--resotore-image\fR [\fIoptions\fR] \fIsource\fR
27 .fi
29 .LP
30 .nf
31 \fBntfsclone\fR \fB--metadata\fR [\fIoptions\fR] \fIsource\fR
32 .fi
34 .SH DESCRIPTION
35 .sp
36 .LP
37 The \fBntfsclone\fR utility efficiently clones (which includes copy, save,
38 backup, and restore operations) or rescues an NTFS filesystem to a sparse file,
39 an image, a device (partition), or to standard output. It works at disk sector
40 level and copies only the written data (that is, not empty space). Unused disk
41 space becomes zero (cloning to sparse file), encoded with control codes (saving
42 in special image format), left unchanged (cloning to a disk/partition) or
43 filled with zeros (cloning to standard output).
44 .sp
45 .LP
46 \fBntfsclone\fR can be useful in making backups\(emtaking an exact snapshot of
47 an NTFS filesystem\(emand restoring it later on. It also can be used to test
48 NTFS read/write functionality and allows you to troubleshoot users' issues
49 using the clone, without the risk of destroying the original file system.
50 .sp
51 .LP
52 If not using the special image format (see section of the same name below), the
53 clone is an exact copy of the original NTFS file system, from sector to sector.
54 Thus, it can also be mounted just like the original NTFS filesystem. For
55 example, if you clone to a file and the kernel has a loopback device and NTFS
56 support, then the file can be mounted using:
57 .sp
58 .in +2
59 .nf
60 # \fBmount -t ntfs -o loop ntfsclone.img\fR
61 .fi
62 .in -2
63 .sp
65 .SS "Windows Cloning"
66 .sp
67 .LP
68 You must exercise great care to copy, move or restore a system or boot
69 partition  to  another computer, or to a different disk or partition (for
70 example, \fB/dev/dsk/c0d0p1\fR to \fB/dev/dsk/c0d0p2\fR, \fB/dev/dsk/c0d0p1\fR
71 to \fB/dev/dsk/c0d1p1\fR or to a different disk sector offset).
72 .sp
73 .LP
74 Under most circumstances, to enable Windows to boot you must copy, move, or
75 restore NTFS to the same partition that has the following characteristics as
76 the original partition and disk:
77 .RS +4
78 .TP
79 .ie t \(bu
80 .el o
81 starts at the same sector
82 .RE
83 .RS +4
84 .TP
85 .ie t \(bu
86 .el o
87 on the same type of disk
88 .RE
89 .RS +4
90 .TP
91 .ie t \(bu
92 .el o
93 having the same BIOS legacy cylinder setting
94 .RE
95 .sp
96 .LP
97 The \fBntfsclone\fR utility guarantees an exact copy of NTFS but does not deal
98 with booting issues. This is by design: \fBntfsclone\fR is a file system, not a
99 system, utility. Its goal is only NTFS cloning, not Windows cloning. Because of
100 this, \fBntfsclone\fR can be used as a very fast and reliable building block
101 for Windows cloning, but is not a complete answer. You can find useful tips on
102 NTFS cloning at the NTFS web site, http://wiki.linux-ntfs.org\&.
103 .SS "Sparse Files"
106 A file containing unallocated blocks (holes) is referred to as a "sparse file".
107 The reported size of such files is always higher than the disk space consumed
108 by them. The \fBdu\fR(1) command reports the real disk space used by a sparse
109 file. The holes are always read as zeros. All major Linux file systems, such
110 as, \fBext2\fR, \fBext3\fR, \fBreiserfs\fR, \fBReiser4\fR, JFS, and XFS support
111 sparse files. However, the ISO 9600 CD-ROM file system, as one example, does
112 not.
113 .SS "Special Image Format"
116 It is recommended that you save an NTFS filesystem to a special image format.
117 Instead of representing unallocated blocks as holes, they are encoded using
118 control codes. Thus, the image saves space without requiring sparse file
119 support. The image format is ideal for streaming file system images over the
120 network. The disadvantage of the special image format is that you cannot mount
121 the image directly; you must first restore it.
124 To save an image using the special image format, use the  \fB-s\fR or  the
125 \fB--save-image\fR option. To restore an image, use the \fB-r\fR or the
126 \fB--restore-image\fR option. Note that you can restore images from  standard
127 input by using a hyphen (\fB-\fR) as the source file.
128 .SS "Metadata-only Cloning"
131 Using the \fB-m\fR or \fB--metadata\fR option, \fBntfsclone\fR can save only
132 the NTFS metadata and the clone still will be mountable. In this usage, all
133 non-metadata file content is lost; reading back the data results in all zeros.
136 The metadata-only image can be compressed very well, usually to a size in the
137 range of 1 to 8 MB. It is convenient to transfer such an image for
138 investigation and troubleshooting.
141 In metadata-only mode, \fBntfsclone\fR saves none of the user's data, which
142 includes the resident user's data embedded into metadata. All is filled with
143 zeros. Moreover, all the file timestamps, and deleted and unused spaces inside
144 the metadata are filled with zeros. Thus, this mode is inappropriate, for
145 example, for forensic analyses.
148 Note that filenames are not removed. Because a filename might contain sensitive
149 information, consider the possibities for breaches of security or privacy
150 before sending out a metadata-only image.
151 .SH OPTIONS
154 Supported options are listed below. Most options have both single-letter and
155 full-name forms. Multiple single-letter options that do not take an argument
156 can be combined. For example, \fB-fv\fR is the equivalent of \fB-f\fR \fB-v\fR.
157 A full-name option can be abbreviated to a unique prefix of its name.
159 .ne 2
161 \fB\fB-f\fR, \fB--force\fR\fR
163 .sp .6
164 .RS 4n
165 Forces \fBntfsclone\fR to proceed, even if the filesystem is marked "dirty"
166 following a consistency check.
170 .ne 2
172 \fB\fB-h\fR, \fB--help\fR\fR
174 .sp .6
175 .RS 4n
176 Show a list of options with a brief description of each one.
180 .ne 2
182 \fB\fB-i\fR, \fB--ignore-fs-check\fR\fR
184 .sp .6
185 .RS 4n
186 Ignore the result of the file system consistency check. This option can be used
187 only with the \fB--meta-data\fR option. Any clusters that cause an
188 inconsistency are saved.
192 .ne 2
194 \fB\fB-m\fR, \fB--metadata\fR\fR
196 .sp .6
197 .RS 4n
198 Clone only metadata. With this option, you must clone only to a file.
202 .ne 2
204 \fB\fB-o\fR, \fB--output\fR \fIfile\fR\fR
206 .sp .6
207 .RS 4n
208 Clone NTFS to the non-existent \fIfile\fR. If \fIfile\fR is a hyphen (\fB-\fR),
209 clone to the standard output.
213 .ne 2
215 \fB\fB-O\fR, \fB--overwrite\fR \fIfile\fR\fR
217 .sp .6
218 .RS 4n
219 Clone NTFS to \fIfile\fR, overwriting \fIfile\fR if it already exists.
223 .ne 2
225 \fB\fB--rescue\fR\fR
227 .sp .6
228 .RS 4n
229 Ignore disk read errors so that a disk having bad sectors, for example, a
230 failing disk, can be rescued with minimal impact on the disk. \fBntfsclone\fR
231 works at the lowest, sector level in this mode, enabling more data to be
232 rescued. The contents of the unreadable sectors are filled with the question
233 mark (\fB?\fR) character; the beginning of such sectors are marked by the
234 string: \fBBadSector\fR.
238 .ne 2
240 \fB\fB-r\fR, \fB--restore-image\fR \fIsource\fR\fR
242 .sp .6
243 .RS 4n
244 Restore from the special image format specified by \fIsource\fR. If
245 \fIsource\fR is a hyphen (\fB-\fR), the image is read from the standard input.
249 .ne 2
251 \fB\fB-s\fR, \fB--save-image\fR\fR
253 .sp .6
254 .RS 4n
255 Save to the special image format. In terms of space usage and speed, this is
256 the most efficient option if imaging is done to the standard output. This
257 option is useful for image compression, encryption, or streaming through a
258 network.
261 .SH EXAMPLES
263 \fBExample 1 \fRCloning with Overwrite Option
266 The following command clones with the \fB--overwrite\fR option.
269 .in +2
271 # \fBntfsclone --overwrite /dev/dsk/c0d2p1 /dev/dsk/c0d0p1\fR
273 .in -2
277 \fBExample 2 \fRSaving to Special Image Format
280 The following command clones to the special image format to its original
281 partition.
284 .in +2
286 # \fBntfsclone --save-image --output backup.img /dev/dsk/c0d0p1\fR
288 .in -2
292 \fBExample 3 \fRRestoring from a Special Image File
295 The following command restores an NTFS from a special image file.
298 .in +2
300 # \fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 backup.img\fR
302 .in -2
306 \fBExample 4 \fRSaving to a Compressed Image
309 The following command saves an NTFS to a compressed image file.
312 .in +2
314 # \fBntfsclone --save-image -o - /dev/dsk/c0d0p1\fR
316 .in -2
320 \fBExample 5 \fRRestoring from a Compressed Image
323 The following command restores an NTFS volume from a compressed image file.
326 .in +2
328 # \fBgunzip -c backup.img.gz | \e\fR
329 \fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
331 .in -2
335 \fBExample 6 \fRBacking up to a Remote Host Using \fBssh\fR
338 The following command backs up to a remote host, using \fBssh\fR(1). Note that
339 \fBssh\fR will probably require a password.
342 .in +2
344 # \fBntfsclone --save-image --output - /dev/dsk/c0d0p1 | \e\fR
345 \fBgzip -c | ssh host `cat > backup.img.gz`\fR
347 .in -2
351 \fBExample 7 \fRRestoring from a Remote Host Using \fBssh\fR
354 The following command backs up to a remote host, using \fBssh\fR(1). Note that
355 \fBssh\fR will probably require a password.
358 .in +2
360 # \fBssh host `cat backup.img.gz` | gunzip -c  | \e\fR
361 \fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
363 .in -2
367 \fBExample 8 \fRStreaming an Image File from a Web Server
370 The following command streams an image file from a web server and restore it to
371 a partition.
374 .in +2
376 # \fBwget -qO - http://server/backup.img | \e\fR
377 \fBntfsclone --restore-image --overwrite /dev/dsk/c0d0p1 -\fR
379 .in -2
383 \fBExample 9 \fRCloning to a New File
386 The following command clones an NTFS volume to a non-existent file.
389 .in +2
391 # \fBntfsclone --output ntfs-clone.img /dev/dsk/c0d0p1\fR
393 .in -2
397 \fBExample 10 \fRPacking NTFS Metadata
400 The following command packs NTFS metadata into an image file. Note that
401 \fBbzip2\fR takes a much longer time than \fBgzip\fR, but produces an archive
402 that is up to ten times smaller than the latter produces.
405 .in +2
407 # \fBntfsclone --metadata --output ntfsmeta.img /dev/dsk/c0d0p1\fR
408 \fBbzip2 ntfsmeta.img\fR
410 .in -2
414 \fBExample 11 \fRUnpacking NTFS Metadata
417 The following command unpacks NTFS metadata into a sparse file.
420 .in +2
422 # \fBbunzip2 -c ntfsmeta.img.bz2 | \e\fR
423 \fBcp --sparse=always /proc/self/fd/0 ntfsmeta.img\fR
425 .in -2
428 .SH EXIT STATUS
431 The return code is zero on success, non-zero otherwise.
432 .SH ATTRIBUTES
435 See \fBattributes\fR(5) for descriptions of the following attributes:
440 box;
441 c | c
442 l | l .
443 ATTRIBUTE TYPE  ATTRIBUTE VALUE
445 Interface Stability     Uncommitted
448 .SH SEE ALSO
451 \fBdu\fR(1), \fBssh\fR(1), \fBntfsresize\fR(1M), \fBntfsundelete\fR(1M),
452 \fBparted\fR(1M), \fBattributes\fR(5)
455 http://wiki.linux-ntfs.org
456 .SH AUTHORS
459 \fBntfsclone\fR was written by Szabolcs Szakacsits with contributions from Per
460 Olofsson (special image format support) and Anton Altaparmakov.