540 lines
16 KiB
HTML
540 lines
16 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of NTFSCLONE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>NTFSCLONE</H1>
|
|
Section: Maintenance Commands (8)<BR>Updated: February 2013<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
ntfsclone - Efficiently clone, image, restore or rescue an NTFS
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>ntfsclone</B>
|
|
|
|
[<I>OPTIONS</I>]
|
|
<I>SOURCE</I>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --save-image</B>
|
|
|
|
[<I>OPTIONS</I>]
|
|
<I>SOURCE</I>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --restore-image</B>
|
|
|
|
[<I>OPTIONS</I>]
|
|
<I>SOURCE</I>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --metadata</B>
|
|
|
|
[<I>OPTIONS</I>]
|
|
<I>SOURCE</I>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>ntfsclone</B>
|
|
|
|
will efficiently clone (copy, save, backup, restore) or rescue an NTFS
|
|
filesystem to a sparse file, image, device (partition) or standard output.
|
|
It works at disk sector level and
|
|
copies only the used data. 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).
|
|
<P>
|
|
<B>ntfsclone</B>
|
|
|
|
can be useful to make backups, an exact snapshot of an NTFS filesystem
|
|
and restore it later on, or for developers to test NTFS read/write
|
|
functionality, troubleshoot/investigate users' issues using the clone
|
|
without the risk of destroying the original filesystem.
|
|
<P>
|
|
The clone, if not using the special image format, is an exact copy of the
|
|
original NTFS filesystem from sector to sector thus it can be also mounted
|
|
just like the original NTFS filesystem.
|
|
For example if you clone to a file and the kernel has loopback device and
|
|
NTFS support then the file can be mounted as
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<P>
|
|
<B>mount -t ntfs -o loop ntfsclone.img /mnt/ntfsclone</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H3>Windows Cloning</H3>
|
|
|
|
If you want to copy, move or restore a system or boot partition to another
|
|
computer, or to a different disk or partition (e.g. hda1->hda2, hda1->hdb1
|
|
or to a different disk sector offset) then you will need to take extra care.
|
|
<P>
|
|
Usually, Windows will not be able to boot, unless you copy, move or restore
|
|
NTFS to the same partition which starts at the same sector on the same type
|
|
of disk having the same BIOS legacy cylinder setting as the original
|
|
partition and disk had.
|
|
<P>
|
|
The ntfsclone utility guarantees to make an exact copy of NTFS but it
|
|
won't deal with booting issues. This is by design: ntfsclone is a
|
|
filesystem, not system utility. Its aim is only NTFS cloning, not Windows
|
|
cloning. Hereby ntfsclone can be used as a very fast and reliable
|
|
build block for Windows cloning but itself it's not enough.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Sparse Files</H3>
|
|
|
|
A file is sparse if it has unallocated blocks (holes). The reported size of
|
|
such files are always higher than the disk space consumed by them. The
|
|
<B>du</B>
|
|
|
|
command can tell the real disk space used by a sparse file.
|
|
The holes are always read as zeros. All major Linux filesystem like,
|
|
ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports
|
|
sparse files but for example the ISO 9600 CD-ROM filesystem doesn't.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Handling Large Sparse Files</H3>
|
|
|
|
As of today Linux provides inadequate support for managing (tar,
|
|
cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files.
|
|
The only main Linux filesystem
|
|
having support for efficient sparse file handling is XFS by the
|
|
XFS_IOC_GETBMAPX
|
|
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)<B>.</B>
|
|
|
|
However none of the common utilities supports it.
|
|
This means when you tar, cp, gzip, bzip2, etc a large sparse file
|
|
they will always read the entire file, even if you use the "sparse support"
|
|
options.
|
|
<P>
|
|
<B><A HREF="/cgi-bin/man/man2html?1+bzip2">bzip2</A></B>(1)
|
|
|
|
compresses large sparse files much better than
|
|
<B><A HREF="/cgi-bin/man/man2html?1+gzip">gzip</A></B>(1)
|
|
|
|
but it does so
|
|
also much slower. Moreover neither of them handles large sparse
|
|
files efficiently during uncompression from disk space usage point
|
|
of view.
|
|
<P>
|
|
At present the most efficient way, both speed and space-wise, to
|
|
compress and uncompress large sparse files by common tools
|
|
would be using
|
|
<B><A HREF="/cgi-bin/man/man2html?1+tar">tar</A></B>(1)
|
|
|
|
with the options
|
|
<B>-S</B>
|
|
|
|
(handle sparse files "efficiently") and
|
|
<B>-j</B>
|
|
|
|
(filter the archive through bzip2). Although
|
|
<B>tar</B>
|
|
|
|
still reads and analyses the entire file, it doesn't pass on the
|
|
large data blocks having only zeros to filters and it also avoids
|
|
writing large amount of zeros to the disk needlessly. But since
|
|
<B>tar</B>
|
|
|
|
can't create an archive from the standard input, you can't do this
|
|
in-place by just reading
|
|
<B>ntfsclone</B>
|
|
|
|
standard output. Even more sadly, using the -S option results
|
|
serious data loss since the end of 2004 and the GNU
|
|
<B>tar</B>
|
|
|
|
maintainers didn't release fixed versions until the present day.
|
|
<A NAME="lbAH"> </A>
|
|
<H3>The Special Image Format</H3>
|
|
|
|
It's also possible, actually it's recommended, to 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
|
|
filesystem images over the network and similar, and can be used as a
|
|
replacement for Ghost or Partition Image if it is combined with other
|
|
tools. The downside is that you can't mount the image directly, you
|
|
need to restore it first.
|
|
<P>
|
|
To save an image using the special image format, use the
|
|
<B>-s</B>
|
|
|
|
or the
|
|
<B>--save-image</B>
|
|
|
|
option. To restore an image, use the
|
|
<B>-r</B>
|
|
|
|
or the
|
|
<B>--restore-image</B>
|
|
|
|
option. Note that you can restore images from standard input by
|
|
using '-' as the
|
|
<I>SOURCE</I>
|
|
|
|
file.
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Metadata-only Cloning</H3>
|
|
|
|
One of the features of
|
|
<B>ntfsclone</B>
|
|
|
|
is that, it can also save only the NTFS metadata using the option
|
|
<B>-m</B>
|
|
|
|
or
|
|
<B>--metadata</B>
|
|
|
|
and the clone still will be
|
|
mountable. In this case all non-metadata file content will be lost and
|
|
reading them back will result always zeros.
|
|
<P>
|
|
The metadata-only image can be compressed very
|
|
well, usually to not more than 1-8 MB thus it's easy to transfer
|
|
for investigation, troubleshooting.
|
|
<P>
|
|
In this mode of ntfsclone,
|
|
<B>NONE</B>
|
|
|
|
of the user's data is saved, including the resident user's data
|
|
embedded into metadata. All is filled with zeros.
|
|
Moreover all the file timestamps, deleted and unused spaces inside
|
|
the metadata are filled with zeros. Thus this mode is inappropriate
|
|
for example for forensic analyses.
|
|
This mode may be combined with <B>--save-image</B> to create a
|
|
special image format file instead of a sparse file.
|
|
<P>
|
|
Please note, filenames are not wiped out. They might contain
|
|
sensitive information, so think twice before sending such an
|
|
image to anybody.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
Below is a summary of all the options that
|
|
<B>ntfsclone</B>
|
|
|
|
accepts. Nearly all options have two equivalent names. The short name is
|
|
preceded by
|
|
<B>-</B>
|
|
|
|
and the long name is preceded by
|
|
<B>-- .</B>
|
|
|
|
Any single letter options, that don't take an argument, can be combined into a
|
|
single command, e.g.
|
|
<B>-fv</B>
|
|
|
|
is equivalent to
|
|
<B>-f -v .</B>
|
|
|
|
Long named options can be abbreviated to any unique prefix of their name.
|
|
<DL COMPACT>
|
|
<DT id="2"><B>-o</B>, <B>--output</B> FILE<DD>
|
|
Clone NTFS to the non-existent
|
|
<I>FILE</I>.
|
|
|
|
If
|
|
<I>FILE</I>
|
|
|
|
is '-' then clone to the
|
|
standard output. This option cannot be used for creating a partition,
|
|
use <B>--overwrite</B> for an existing partition.
|
|
<DT id="3"><B>-O</B>, <B>--overwrite</B> FILE<DD>
|
|
Clone NTFS to
|
|
<I>FILE</I>,
|
|
|
|
which can be an existing partition or a regular file which will be
|
|
overwritten if it exists.
|
|
<DT id="4"><B>-s</B>, <B>--save-image</B><DD>
|
|
Save to the special image format. This is the most efficient way space and
|
|
speed-wise if imaging is done to the standard output, e.g. for image
|
|
compression, encryption or streaming through a network.
|
|
<DT id="5"><B>-r</B>, <B>--restore-image</B><DD>
|
|
Restore from the special image format specified by
|
|
<I>SOURCE</I>
|
|
|
|
argument. If the
|
|
<I>SOURCE</I>
|
|
|
|
is '-' then the image is read from the standard input.
|
|
<DT id="6"><B>-n</B>, <B>--no-action</B><DD>
|
|
Test the consistency of a saved image by simulating its restoring without
|
|
writing anything. The NTFS data contained in the image is not tested.
|
|
The option <B>--restore-image</B> must also be present, and the options
|
|
<B>--output</B> and <B>--overwrite</B> must be omitted.
|
|
<DT id="7"><B>--rescue</B><DD>
|
|
Ignore disk read errors so disks having bad sectors, e.g. dying disks, can be
|
|
rescued the most efficiently way, with minimal stress on them. Ntfsclone works
|
|
at the lowest, sector level in this mode too thus more data can be rescued.
|
|
The contents of the unreadable sectors are filled by character '?' and the
|
|
beginning of such sectors are marked by "BadSectoR\0".
|
|
<DT id="8"><B>-m</B>, <B>--metadata</B><DD>
|
|
Clone
|
|
<B>ONLY METADATA</B>
|
|
|
|
(for NTFS experts). Only cloning to a (sparse) file is allowed, unless used
|
|
the option <B>--save-image</B> is also used.
|
|
You can't metadata-only clone to a device.
|
|
<DT id="9"><B>--ignore-fs-check</B><DD>
|
|
Ignore the result of the filesystem consistency check. This option is allowed
|
|
to be used only with the
|
|
<B>--metadata</B>
|
|
|
|
option, for the safety of user's data. The clusters which cause the
|
|
inconsistency are saved too.
|
|
<DT id="10"><B>-t</B>, <B>--preserve-timestamps</B><DD>
|
|
Do not wipe the timestamps, to be used only with the
|
|
<B>--metadata</B>
|
|
|
|
option.
|
|
<DT id="11"><B>--full-logfile</B><DD>
|
|
Include the Windows log file in the copy. This is only useful for
|
|
extracting metadata, saving or cloning a file system which was not
|
|
properly unmounted from Windows.
|
|
<DT id="12"><B>--new-serial</B>, or<DD>
|
|
<DT id="13"><B>--new-half-serial</B><DD>
|
|
Set a new random serial number to the clone. The serial number is a 64
|
|
bit number used to identify the device during the mounting process, so
|
|
it has to be changed to enable the original file system
|
|
and the clone to be mounted at the same time on the same computer.
|
|
<P>
|
|
The option <B>--new-half-serial</B> only changes the upper part of the
|
|
serial number, keeping the lower part which is used by Windows unchanged.
|
|
<P>
|
|
The options <B>--new-serial</B> and <B>--new-half-serial</B> can
|
|
only be used when cloning a file system of restoring from an image.
|
|
<P>
|
|
The serial number is not the volume UUID used by Windows
|
|
to locate files which have been moved to another volume.
|
|
<P>
|
|
<DT id="14"><B>-f</B>, <B>--force</B><DD>
|
|
Forces ntfsclone to proceed if the filesystem is marked
|
|
"dirty" for consistency check.
|
|
<DT id="15"><B>-q</B>, <B>--quiet</B><DD>
|
|
Do not display any progress-bars during operation.
|
|
<DT id="16"><B>-h</B>, <B>--help</B><DD>
|
|
Show a list of options with a brief description of each one.
|
|
</DL>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>EXIT CODES</H2>
|
|
|
|
The exit code is 0 on success, non-zero otherwise.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
Clone NTFS on /dev/hda1 to /dev/hdc1:
|
|
<DL COMPACT><DT id="17"><DD>
|
|
<P>
|
|
<B>ntfsclone --overwrite /dev/hdc1 /dev/hda1</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Save an NTFS to a file in the special image format:
|
|
<DL COMPACT><DT id="18"><DD>
|
|
<P>
|
|
<B>ntfsclone --save-image --output backup.img /dev/hda1</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Restore an NTFS from a special image file to its original partition:
|
|
<DL COMPACT><DT id="19"><DD>
|
|
<P>
|
|
<B>ntfsclone --restore-image --overwrite /dev/hda1 backup.img</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Save an NTFS into a compressed image file:
|
|
<DL COMPACT><DT id="20"><DD>
|
|
<P>
|
|
<B>ntfsclone --save-image -o - /dev/hda1 | gzip -c > backup.img.gz</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Restore an NTFS volume from a compressed image file:
|
|
<DL COMPACT><DT id="21"><DD>
|
|
<P>
|
|
<B>gunzip -c backup.img.gz | \\</B>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --restore-image --overwrite /dev/hda1 -</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Backup an NTFS volume to a remote host, using ssh. Please note, that
|
|
ssh may ask for a password!
|
|
<DL COMPACT><DT id="22"><DD>
|
|
<P>
|
|
<B>ntfsclone --save-image --output - /dev/hda1 | \\</B>
|
|
|
|
<BR>
|
|
|
|
<B>gzip -c | ssh host 'cat > backup.img.gz'</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Restore an NTFS volume from a remote host via ssh. Please note, that
|
|
ssh may ask for a password!
|
|
<DL COMPACT><DT id="23"><DD>
|
|
<P>
|
|
<B>ssh host 'cat backup.img.gz' | gunzip -c | \\</B>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --restore-image --overwrite /dev/hda1 -</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Stream an image file from a web server and restore it to a partition:
|
|
<DL COMPACT><DT id="24"><DD>
|
|
<P>
|
|
<B>wget -qO - <A HREF="http://server/backup.img">http://server/backup.img</A> | \\</B>
|
|
|
|
<BR>
|
|
|
|
<B>ntfsclone --restore-image --overwrite /dev/hda1 -</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Clone an NTFS volume to a non-existent file:
|
|
<DL COMPACT><DT id="25"><DD>
|
|
<P>
|
|
<B>ntfsclone --output ntfs-clone.img /dev/hda1</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Pack NTFS metadata for NTFS experts. Please note that bzip2 runs
|
|
very long but results usually at least 10 times smaller archives
|
|
than gzip on a sparse file.
|
|
<DL COMPACT><DT id="26"><DD>
|
|
<P>
|
|
<B>ntfsclone --metadata --output ntfsmeta.img /dev/hda1</B>
|
|
|
|
<BR>
|
|
|
|
<B>bzip2 ntfsmeta.img</B>
|
|
|
|
<P>
|
|
Or, outputting to a compressed image :
|
|
<BR>
|
|
|
|
<B>ntfsclone -mst --output - /dev/hda1 | bzip2 > ntfsmeta.bz2</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
Unpacking NTFS metadata into a sparse file:
|
|
<DL COMPACT><DT id="27"><DD>
|
|
<P>
|
|
<B>bunzip2 -c ntfsmeta.img.bz2 | \\</B>
|
|
|
|
<BR>
|
|
|
|
<B>cp --sparse=always /proc/self/fd/0 ntfsmeta.img</B>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>KNOWN ISSUES</H2>
|
|
|
|
There are no known problems with
|
|
<B>ntfsclone</B>.
|
|
|
|
If you think you have found a problem then please send an email describing it
|
|
to the development team:
|
|
|
|
<A HREF="mailto:ntfs-3g-devel@lists.sf.net">ntfs-3g-devel@lists.sf.net</A>
|
|
|
|
<P>
|
|
Sometimes it might appear ntfsclone froze if the clone is on ReiserFS
|
|
and even CTRL-C won't stop it. This is not a bug in ntfsclone, however
|
|
it's due to ReiserFS being extremely inefficient creating large
|
|
sparse files and not handling signals during this operation. This
|
|
ReiserFS problem was improved in kernel 2.4.22.
|
|
XFS, JFS and ext3 don't have this problem.
|
|
|
|
<A NAME="lbAN"> </A>
|
|
<H2>AUTHORS</H2>
|
|
|
|
<B>ntfsclone</B>
|
|
|
|
was written by Szabolcs Szakacsits with contributions from Per Olofsson
|
|
(special image format support) and Anton Altaparmakov.
|
|
It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
|
|
<A NAME="lbAO"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
<B>ntfsclone</B>
|
|
|
|
is part of the
|
|
<B>ntfs-3g</B>
|
|
|
|
package and is available at:
|
|
<BR>
|
|
|
|
|
|
<A HREF="http://www.tuxera.com/community/">http://www.tuxera.com/community/</A>
|
|
|
|
<A NAME="lbAP"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ntfsresize">ntfsresize</A></B>(8)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ntfsprogs">ntfsprogs</A></B>(8)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+xfs_copy">xfs_copy</A></B>(8)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+debugreiserfs">debugreiserfs</A></B>(8)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+e2image">e2image</A></B>(8)
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="28"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="29"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="30"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="31"><A HREF="#lbAE">Windows Cloning</A><DD>
|
|
<DT id="32"><A HREF="#lbAF">Sparse Files</A><DD>
|
|
<DT id="33"><A HREF="#lbAG">Handling Large Sparse Files</A><DD>
|
|
<DT id="34"><A HREF="#lbAH">The Special Image Format</A><DD>
|
|
<DT id="35"><A HREF="#lbAI">Metadata-only Cloning</A><DD>
|
|
</DL>
|
|
<DT id="36"><A HREF="#lbAJ">OPTIONS</A><DD>
|
|
<DT id="37"><A HREF="#lbAK">EXIT CODES</A><DD>
|
|
<DT id="38"><A HREF="#lbAL">EXAMPLES</A><DD>
|
|
<DT id="39"><A HREF="#lbAM">KNOWN ISSUES</A><DD>
|
|
<DT id="40"><A HREF="#lbAN">AUTHORS</A><DD>
|
|
<DT id="41"><A HREF="#lbAO">AVAILABILITY</A><DD>
|
|
<DT id="42"><A HREF="#lbAP">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:14 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|