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 clonning 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 -f, --force
170 Forces ntfsclone to proceed if the filesystem is marked "dirty"
171 for consistency check.
172
173 -h, --help
174 Show a list of options with a brief description of each one.
175
177 The exit code is 0 on success, non-zero otherwise.
178
180 Clone NTFS on /dev/hda1 to /dev/hdc1:
181
182 ntfsclone --overwrite /dev/hdc1 /dev/hda1
183
184 Save an NTFS to a file in the special image format:
185
186 ntfsclone --save-image --output backup.img /dev/hda1
187
188 Restore an NTFS from a special image file to its original partition:
189
190 ntfsclone --restore-image --overwrite /dev/hda1 backup.img
191
192 Save an NTFS into a compressed image file:
193
194 ntfsclone --save-image -o - /dev/hda1 | gzip -c > backup.img.gz
195
196 Restore an NTFS volume from a compressed image file:
197
198 gunzip -c backup.img.gz | \
199 ntfsclone --restore-image --overwrite /dev/hda1 -
200
201 Backup an NTFS volume to a remote host, using ssh. Please note, that
202 ssh may ask for a password!
203
204 ntfsclone --save-image --output - /dev/hda1 | \
205 gzip -c | ssh host 'cat > backup.img.gz'
206
207 Restore an NTFS volume from a remote host via ssh. Please note, that
208 ssh may ask for a password!
209
210 ssh host 'cat backup.img.gz' | gunzip -c | \
211 ntfsclone --restore-image --overwrite /dev/hda1 -
212
213 Stream an image file from a web server and restore it to a partition:
214
215 wget -qO - http://server/backup.img | \
216 ntfsclone --restore-image --overwrite /dev/hda1 -
217
218 Clone an NTFS volume to a non-existent file:
219
220 ntfsclone --output ntfs-clone.img /dev/hda1
221
222 Pack NTFS metadata for NTFS experts. Please note that bzip2 runs very
223 long but results usually at least 10 times smaller archives than gzip.
224
225 ntfsclone --metadata --output ntfsmeta.img /dev/hda1
226 bzip2 ntfsmeta.img
227
228 Unpacking NTFS metadata into a sparse file:
229
230 bunzip2 -c ntfsmeta.img.bz2 | \
231 cp --sparse=always /proc/self/fd/0 ntfsmeta.img
232
233
235 There are no known problems with ntfsclone. If you think you have
236 found a problem then please send an email describing it to the develop‐
237 ment team: linux-ntfs-dev@lists.sourceforge.net
238
239 Sometimes it might appear ntfsclone froze if the clone is on ReiserFS
240 and even CTRL-C won't stop it. This is not a bug in ntfsclone, however
241 it's due to ReiserFS being extremely inefficient creating large sparse
242 files and not handling signals during this operation. This ReiserFS
243 problem was improved in kernel 2.4.22. XFS, JFS and ext3 don't have
244 this problem.
245
247 ntfsclone was written by Szabolcs Szakacsits with contributions from
248 Per Olofsson (special image format support) and Anton Altaparmakov.
249
251 ntfsclone is part of the ntfsprogs package and is available at:
252 http://www.linux-ntfs.org/content/view/19/37
253
254 The latest manual pages are available at:
255 http://man.linux-ntfs.org/
256
257 Additional up-to-date information can be found furthermore at:
258 http://wiki.linux-ntfs.org/doku.php?id=ntfsclone
259
261 ntfsresize(8) ntfsprogs(8) xfs_copy(8) debugreiserfs(8) e2image(8)
262
263
264
265ntfsprogs 1.13.1 February 2006 NTFSCLONE(8)