1NTFSCLONE(8) System Manager's Manual NTFSCLONE(8)
2
3
4
6 ntfsclone - Efficiently clone, image, restore or rescue an NTFS
7
9 ntfsclone [OPTIONS] SOURCE
10 ntfsclone --save-image [OPTIONS] SOURCE
11 ntfsclone --restore-image [OPTIONS] SOURCE
12 ntfsclone --metadata [OPTIONS] SOURCE
13
15 ntfsclone will efficiently clone (copy, save, backup, restore) or res‐
16 cue an NTFS filesystem to a sparse file, image, device (partition) or
17 standard output. It works at disk sector level and copies only the
18 used data. Unused disk space becomes zero (cloning to sparse file),
19 encoded with control codes (saving in special image format), left
20 unchanged (cloning to a disk/partition) or filled with zeros (cloning
21 to standard output).
22
23 ntfsclone can be useful to make backups, an exact snapshot of an NTFS
24 filesystem and restore it later on, or for developers to test NTFS
25 read/write functionality, troubleshoot/investigate users' issues using
26 the clone without the risk of destroying the original filesystem.
27
28 The clone, if not using the special image format, is an exact copy of
29 the original NTFS filesystem from sector to sector thus it can be also
30 mounted just like the original NTFS filesystem. For example if you
31 clone to a file and the kernel has loopback device and NTFS support
32 then the file can be mounted as
33
34 mount -t ntfs -o loop ntfsclone.img /mnt/ntfsclone
35
36
37 Windows Cloning
38 If you want to copy, move or restore a system or boot partition to
39 another computer, or to a different disk or partition (e.g. hda1->hda2,
40 hda1->hdb1 or to a different disk sector offset) then you will need to
41 take extra care.
42
43 Usually, Windows will not be able to boot, unless you copy, move or
44 restore NTFS to the same partition which starts at the same sector on
45 the same type of disk having the same BIOS legacy cylinder setting as
46 the original partition and disk had.
47
48 The ntfsclone utility guarantees to make an exact copy of NTFS but it
49 won't deal with booting issues. This is by design: ntfsclone is a
50 filesystem, not system utility. Its aim is only NTFS cloning, not Win‐
51 dows cloning. Hereby ntfsclone can be used as a very fast and reliable
52 build block for Windows cloning but itself it's not enough. You can
53 find useful tips following the related links on the below page
54 http://wiki.linux-ntfs.org/doku.php?id=ntfsclone
55
56 Sparse Files
57 A file is sparse if it has unallocated blocks (holes). The reported
58 size of such files are always higher than the disk space consumed by
59 them. The du command can tell the real disk space used by a sparse
60 file. The holes are always read as zeros. All major Linux filesystem
61 like, ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports sparse files
62 but for example the ISO 9600 CD-ROM filesystem doesn't.
63
64 Handling Large Sparse Files
65 As of today Linux provides inadequate support for managing (tar, cp,
66 gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. The only
67 main Linux filesystem having support for efficient sparse file handling
68 is XFS by the XFS_IOC_GETBMAPX ioctl(2). However none of the common
69 utilities supports it. This means when you tar, cp, gzip, bzip2, etc a
70 large sparse file they will always read the entire file, even if you
71 use the "sparse support" options.
72
73 bzip2(1) compresses large sparse files much better than gzip(1) but it
74 does so also much slower. Moreover neither of them handles large sparse
75 files efficiently during uncompression from disk space usage point of
76 view.
77
78 At present the most efficient way, both speed and space-wise, to com‐
79 press and uncompress large sparse files by common tools would be using
80 tar(1) with the options -S (handle sparse files "efficiently") and -j
81 (filter the archive through bzip2). Although tar still reads and analy‐
82 ses the entire file, it doesn't pass on the large data blocks having
83 only zeros to filters and it also avoids writing large amount of zeros
84 to the disk needlessly. But since tar can't create an archive from the
85 standard input, you can't do this in-place by just reading ntfsclone
86 standard output. Even more sadly, using the -S option results serious
87 data loss since the end of 2004 and the GNU tar maintainers didn't re‐
88 lease fixed versions until the present day.
89
90 The Special Image Format
91 It's also possible, actually it's recommended, to save an NTFS filesys‐
92 tem to a special image format. Instead of representing unallocated
93 blocks as holes, they are encoded using control codes. Thus, the image
94 saves space without requiring sparse file support. The image format is
95 ideal for streaming filesystem images over the network and similar, and
96 can be used as a replacement for Ghost or Partition Image if it is com‐
97 bined with other tools. The downside is that you can't mount the image
98 directly, you need to restore it first.
99
100 To save an image using the special image format, use the -s or the
101 --save-image option. To restore an image, use the -r or the --re‐
102 store-image option. Note that you can restore images from standard in‐
103 put by using '-' as the SOURCE file.
104
105 Metadata-only Cloning
106 One of the features of ntfsclone is that, it can also save only the
107 NTFS metadata using the option -m or --metadata and the clone still
108 will be mountable. In this case all non-metadata file content will be
109 lost and reading them back will result always zeros.
110
111 The metadata-only image can be compressed very well, usually to not
112 more than 1-8 MB thus it's easy to transfer for investigation, trou‐
113 bleshooting.
114
115 In this mode of ntfsclone, NONE of the user's data is saved, including
116 the resident user's data embedded into metadata. All is filled with ze‐
117 ros. Moreover all the file timestamps, deleted and unused spaces in‐
118 side the metadata are filled with zeros. Thus this mode is inappropri‐
119 ate for example for forensic analyses.
120
121 Please note, filenames are not wiped out. They might contain sensitive
122 information, so think twice before sending such an image to anybody.
123
125 Below is a summary of all the options that ntfsclone accepts. Nearly
126 all options have two equivalent names. The short name is preceded by -
127 and the long name is preceded by -- . Any single letter options, that
128 don't take an argument, can be combined into a single command, e.g.
129 -fv is equivalent to -f -v . Long named options can be abbreviated to
130 any unique prefix of their name.
131
132 -o, --output FILE
133 Clone NTFS to the non-existent FILE. If FILE is '-' then clone
134 to the standard output.
135
136 -O, --overwrite FILE
137 Clone NTFS to FILE, overwriting if exists.
138
139 -s, --save-image
140 Save to the special image format. This is the most efficient way
141 space and speed-wise if imaging is done to the standard output,
142 e.g. for image compression, encryption or streaming through a
143 network.
144
145 -r, --restore-image
146 Restore from the special image format specified by SOURCE argu‐
147 ment. If the SOURCE is '-' then the image is read from the stan‐
148 dard input.
149
150 --rescue
151 Ignore disk read errors so disks having bad sectors, e.g. dying
152 disks, can be rescued the most efficiently way, with minimal
153 stress on them. Ntfsclone works at the lowest, sector level in
154 this mode too thus more data can be rescued. The contents of
155 the unreadable sectors are filled by character '?' and the be‐
156 ginning of such sectors are marked by "BadSectoR\0".
157
158 -m, --metadata
159 Clone ONLY METADATA (for NTFS experts). Moreover only cloning to
160 a file is allowed. You can't metadata-only clone to a device,
161 image or standard output.
162
163 --ignore-fs-check
164 Ignore the result of the filesystem consistency check. This op‐
165 tion is allowed to be used only with the --metadata option, for
166 the safety of user's data. The clusters which cause the incon‐
167 sistency are saved too.
168
169 -t, --preserve-timestamps
170 Do not wipe the timestamps, to be used only with the --metadata
171 option.
172
173 -f, --force
174 Forces ntfsclone to proceed if the filesystem is marked "dirty"
175 for consistency check.
176
177 -h, --help
178 Show a list of options with a brief description of each one.
179
181 The exit code is 0 on success, non-zero otherwise.
182
184 Clone NTFS on /dev/hda1 to /dev/hdc1:
185
186 ntfsclone --overwrite /dev/hdc1 /dev/hda1
187
188 Save an NTFS to a file in the special image format:
189
190 ntfsclone --save-image --output backup.img /dev/hda1
191
192 Restore an NTFS from a special image file to its original partition:
193
194 ntfsclone --restore-image --overwrite /dev/hda1 backup.img
195
196 Save an NTFS into a compressed image file:
197
198 ntfsclone --save-image -o - /dev/hda1 | gzip -c > backup.img.gz
199
200 Restore an NTFS volume from a compressed image file:
201
202 gunzip -c backup.img.gz | \
203 ntfsclone --restore-image --overwrite /dev/hda1 -
204
205 Backup an NTFS volume to a remote host, using ssh. Please note, that
206 ssh may ask for a password!
207
208 ntfsclone --save-image --output - /dev/hda1 | \
209 gzip -c | ssh host 'cat > backup.img.gz'
210
211 Restore an NTFS volume from a remote host via ssh. Please note, that
212 ssh may ask for a password!
213
214 ssh host 'cat backup.img.gz' | gunzip -c | \
215 ntfsclone --restore-image --overwrite /dev/hda1 -
216
217 Stream an image file from a web server and restore it to a partition:
218
219 wget -qO - http://server/backup.img | \
220 ntfsclone --restore-image --overwrite /dev/hda1 -
221
222 Clone an NTFS volume to a non-existent file:
223
224 ntfsclone --output ntfs-clone.img /dev/hda1
225
226 Pack NTFS metadata for NTFS experts. Please note that bzip2 runs very
227 long but results usually at least 10 times smaller archives than gzip.
228
229 ntfsclone --metadata --output ntfsmeta.img /dev/hda1
230 bzip2 ntfsmeta.img
231
232 Unpacking NTFS metadata into a sparse file:
233
234 bunzip2 -c ntfsmeta.img.bz2 | \
235 cp --sparse=always /proc/self/fd/0 ntfsmeta.img
236
237
239 There are no known problems with ntfsclone. If you think you have
240 found a problem then please send an email describing it to the develop‐
241 ment team: ntfs-3g-devel@lists.sf.net
242
243 Sometimes it might appear ntfsclone froze if the clone is on ReiserFS
244 and even CTRL-C won't stop it. This is not a bug in ntfsclone, however
245 it's due to ReiserFS being extremely inefficient creating large sparse
246 files and not handling signals during this operation. This ReiserFS
247 problem was improved in kernel 2.4.22. XFS, JFS and ext3 don't have
248 this problem.
249
251 ntfsclone was written by Szabolcs Szakacsits with contributions from
252 Per Olofsson (special image format support) and Anton Altaparmakov. It
253 was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
254
256 ntfsclone is part of the ntfs-3g package and is available at:
257 http://www.tuxera.com/community/
258
259 The latest manual pages are available at:
260 http://man.linux-ntfs.org/
261
262 Additional up-to-date information can be found furthermore at:
263 http://wiki.linux-ntfs.org/doku.php?id=ntfsclone
264
266 ntfsresize(8) ntfsprogs(8) xfs_copy(8) debugreiserfs(8) e2image(8)
267
268
269
270ntfs-3g 2011.4.12 February 2006 NTFSCLONE(8)