Commit Graph

166 Commits

Author SHA1 Message Date
Jean-Pierre André
90c361e7f8 Allocated full clusters for reading and rescuing in ntfsclone
Even though mft or index records may be smaller than a cluster,
reading and rescuing them is done on a full cluster base, so
full clusters must be allocated for processing them.
2018-08-02 16:41:19 +02:00
Jean-Pierre André
f862fcee00 Extended the allowed cluster size to 2MB
From Windows 10 Creators edition, the cluster size limit has been
extended to 2MB. This has implied redefining the boot sector field
"sectors_per_cluster" so that values greater than 128 can be recorded.
2018-06-01 16:29:01 +02:00
Jean-Pierre André
ba810877ca Bypassed cluster allocation errors using --ignore-fs-check in ntfsclone
When using option --ignore-fs-check in ntfsclone, doubly allocated cluster
still lead to aborting the process. Bypassing the error is useful for
creating a metadata image intended for debugging, for example when the
partition was not closed properly and the logfile has to be applied to
restore the integrity of metadata.
2017-05-25 10:28:05 +02:00
Jean-Pierre André
7917a0a6cc Fixed indentation in ntfsclone help text (cosmetic)
The tabs in source code appear differently in actual output.
2016-04-06 11:09:35 +02:00
Jean-Pierre André
8e550e712d Added an option for preserving the full log file in ntfsclone
Usually, only a few pages of the Windows log file are saved in an
ntfsclone image. This is inappropriate for building reference images
for recovering the log, and the --full-logfile option serves that
purpose.
2016-04-06 08:51:36 +02:00
Jean-Pierre André
941ec4762f Silenced a compiler warning for different types
Some compilers issue a warning when the alternatives in a "? :"
expression have different signedness.
2016-02-15 12:02:10 +01:00
Erik Larsson
9893ea9ee6 Merge endianness fixes.
Conflicts:
	libntfs-3g/attrib.c
2016-01-28 09:22:42 +01:00
Erik Larsson
9cf04fd2cd Fix incorrect usage of native/little-endian types, signed types, etc.
This is harmless with regard to code generation but if we turn on strict
type checking these type mismatches will result in errors.
2015-12-21 23:55:31 +01:00
Jean-Pierre André
fb0afd41c8 Decoded the full list of bad clusters in ntfsclone and ntfsresize
When the bad cluster list required extent, ntfsclone and ntfsresize
did not process the extents, leading to unexpected read errors and
unmatching bitmaps. This fix enables the full list to be taken into
account.
2015-11-09 16:16:39 +01:00
Erik Larsson
82bb43eed3 ntfsclone.c: Compile fix for OS X.
OS X keeps the statfs declarations in sys/mount.h.
2015-03-13 08:59:20 +01:00
Jean-Pierre André
c0287870e1 Returned success from ntfsprogs utilities with options --version and --help
The ntfsprogs used to return failure when option --version or --help
was used, and this has triggered complains from distribution packagers
who use these options in packaging scripts.
With this patch, success is returned (same behavior as gcc).
2014-04-23 10:13:27 +02:00
Jean-Pierre André
f3c4c6c604 Fixed ioctl() error return for ntfsclone on Windows
The ioctl() function is not implemented in the Windows variant. By forcing
a negative apparent return, an alternative is triggered to get the
partition size which is normally obtained from an ioctl().
2014-04-12 09:14:08 +02:00
Jean-Pierre André
ddd3a8a329 Reset the output file to favour appending to image in ntfsclone
When ntfsclone'ing to a file, the target file was truncated to the volume
size. This is not useful on file systems which support sparse files. In
the case of ntfs-3g this leads to prevent optimizations specific to
appending data. So when a sparse output file is detected, it is emptied
to benefit from subsequent appending of data.
2014-03-11 09:54:53 +01:00
Jean-Pierre André
d2daead832 Updated copyright claims 2014-02-16 18:25:09 +01:00
Jean-Pierre André
a6b765c824 Fixed rescuing clusters by physical sectors in ntfsclone
When a sector is unreadable, consider the whole sector as bad, instead
of trying to find which 512-byte parts of it are bad. This was causing
unwanted retries for devices with 4K sectors.
2013-02-09 15:07:06 +01:00
Jean-Pierre André
a086683ece Fixed setting a magic header to unreadable sectors in ntfsclone
The magic header of an unreadable sectors should have the size of
"BadSectoR", not the size of a pointer to it.
2013-02-09 15:04:41 +01:00
Jean-Pierre André
c73b805062 Rejected reading a volume from stdin in ntfsclone
Reading a volume must be done in a seekable way. Better throw a proper
error.
2013-02-09 15:01:36 +01:00
Jean-Pierre André
e6eae9fa16 Ported ntfsclone to Windows
This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.
2013-02-09 12:54:44 +01:00
Jean-Pierre André
88de9987a0 Fixed bad copying of the backup boot sector in ntfsclone
This patch fixes the sector offset to the backup boot sector when creating
a metadata image.
2013-02-09 12:53:38 +01:00
Jean-Pierre André
d32c593521 Revert "Ported ntfsclone to Windows", should be "Fixed bad copying of the backup boot sector"
This reverts commit 92cd41b6e5.

The title and description were wrong
2013-02-09 12:50:16 +01:00
Jean-Pierre André
92cd41b6e5 Ported ntfsclone to Windows
This mainly means using the functions in win32_io.c instead of the
standard msvcrt.dll ones in order to be able to truncate files and
create sparse ones.
2013-02-09 12:14:19 +01:00
Jean-Pierre André
c4f65e05c4 Cleaned selecting stdout or stderr for messages from ntfsclone
Depending on the options selected, ntfsclone messages are output on
stdout or stderr. This is now done through standard logging procedures.
2013-02-09 12:12:02 +01:00
Jean-Pierre André
61eceb2fe5 Cosmetic : use symbolic names for ntfsclone control codes
Defining symbolic names makes it easier to identify where they are used.
2013-02-09 11:48:54 +01:00
Jean-Pierre André
81eb7baf88 Allowed cloning a file system despite allocation errors
Allow the "--ignore-fs-check" option to be used when cloning a file system
which has allocation errors. This is useful when there is a fear that
repairing the file system might create further damage, or when the repair
has to be made on another computer.
2013-02-09 11:41:39 +01:00
Jean-Pierre André
c820cb6d76 Added a display of the location of an inconsistency in an image
When an ntfsclone image appears to be corrupted, show at which position
the error happens. This is useful for providing support.
2013-02-09 11:37:31 +01:00
Jean-Pierre André
7c83060553 Added a new option for testing the consistency of an ntfsclone image
This patch adds a new option -n to ntfsclone for simulating a restore
without writing anything. This is useful for checking the consistency
of an image without destroying the original partition.
2013-02-09 11:29:21 +01:00
Jean-Pierre André
7cb4b99627 Fixed wiping fragmented metadata when creating a metadata image
When creating a metadata image, all user data is supposed to be wiped off,
but this was wrong for $MFT and directory indexes when they were
fragmented. This patch cleans the tails of metadata fragments.
2013-02-09 11:12:45 +01:00
Erik Larsson
7506d8b80b Rename legacy MS_* flags for ntfs_mount with NTFS_MNT_* flags.
The MS_* flags originated from system constants. However the flags
passed to ntfs_mount were really unrelated to the system constants and
many new MS_* flags had to be introduced as different features were
added to the library. Those flags had no counterparts in any system
APIs, so using the same naming scheme is inappropriate.

Instead, let's namespace these flags similarly to what has already been
done in ntfsprogs/libntfs earlier. This avoids any possible conflicts
with system constants.
The values of the flags themselves are kept the same as earlier, so
backward compatibility is retained.
2012-11-07 16:29:48 +01:00
Erik Larsson
11a7e8297d ntfsclone.c: Cleanup in error message. 2012-11-06 08:23:04 +01:00
Erik Larsson
e85f9305c1 ntfsclone.c: Fix missing space in error message. 2012-11-06 02:07:53 +01:00
Jean-Pierre André
ba3cb2c88b Fixed displaying progress percentage for metadata images
When building (options -ms) or restoring a metadata image, the progress
percentages were wrong (evaluated against a wrong base)
2012-08-20 13:44:33 +02:00
Jean-Pierre André
54f96e4af1 Implemented an option to set a new serial number in ntfsclone
Defined new options --new-serial and --new-half-serial to set a new
random serial number when cloning or restoring a file system.
Useful for mounting the original and the cloned file system at the
same time.
2012-01-23 18:19:17 +01:00
Jean-Pierre André
e7bfd31de4 Fixed clearing user data when creating metadata images
Clearing of user data was wrong when extracting the metadata into a
special format image. In this situation the clearing has to be done
without mounting the file system.
2012-01-23 18:13:59 +01:00
Jean-Pierre André
4a0892eb26 Implemented a new option -q to avoid updating the progress information (Matthew Boyle)
The progress bars complexify the integration of ntfsclone into other
tools, the option -q (or --quiet) gets rid of them.
2012-01-23 18:10:26 +01:00
Jean-Pierre André
5593ee2711 fixed clearing the end of extents when extracting metadata
When extracting the metadata, unused data at the end of MFT records is
supposed to be cleared. This was done for the base record of each file,
but not for the extent records.
2012-01-23 17:11:46 +01:00
Jean-Pierre André
42597c830d Developped creating a metadata image in ntfsclone
With this patch a metadata image can be created without creating
an intermediate file. Use both option -m and -s.
2011-10-07 11:42:08 +02:00
Jean-Pierre André
08bf2b5bcb Avoided logging meaningless fixup errors in ntfsclone and ntfsresize
Logging of fixup errors for uninitialized inodes cause unnecessary
worries and suspicion of malfunctions in ntfs-3g. This patch silences
these loggings in ntfsclone and ntfsresize which have to analyze all
inodes, including the uninitialized ones.
2011-09-23 11:28:42 +02:00
Jean-Pierre André
1673ce9c91 Accepted the backup bootsector not be to accounted for when cloning 2011-07-05 12:17:29 +02:00
Jean-Pierre André
259b8ab308 Fixed compilation on OpenIndiana (Apostolos Syropoulos) 2011-07-05 12:17:11 +02:00
Jean-Pierre André
b4d1c6165b Used a stream to produce aligned writes in image creation
When creating a partition image, ntfsclone write an extra byte to
describe each cluster, this causes two unneeded ntfs-3g calls per cluster,
and inefficiency when imaging to ntfs.
2011-03-23 09:35:24 +01:00
Jean-Pierre André
c6da530efc Synced the created image before remounting in ntfsclone
Better sync before remounting, but probably not an error
2011-03-23 08:59:49 +01:00
Jean-Pierre André
e20c1df1e5 Fixed copying the backup boot sector on a partial cluster
A recent patch added copying the backup boot sector when cloning,
saving or restoring a partition, but when the total number of sectors is
not a multiple of the number of sectors per cluster, the last cluster
containing the backup boot sector is shorter than usual.
When this happens, the present patch avoids overflowing from partition
when accessing the last cluster.
2011-02-17 16:11:26 +01:00
Jean-Pierre André
f68259e0c2 Copied the alternate boot sector when cloning 2011-02-16 12:18:56 +01:00
Jean-Pierre André
70490ce10e Silenced warnings for no return 2010-12-21 15:51:08 +01:00
Jean-Pierre André
3a6ea1f2c9 Avoided writing beyond allocated variable 2010-12-21 15:51:07 +01:00
Jean-Pierre André
f21110f9a3 Closed volume and cleaned up when exiting from ntfsclone 2010-12-21 15:51:07 +01:00
Jean-Pierre André
31ce5db142 Added option for not clearing the timestamps in ntfsclone 2010-12-21 15:51:07 +01:00
Jean-Pierre André
f3e6a1af01 Fixed reading old big-endian ntfsclone images 2010-12-21 15:51:07 +01:00
Jean-Pierre André
8f4aa0883b Strengthened variable types 2010-12-21 15:51:07 +01:00
Jean-Pierre André
1ca4a556b2 Silenced warnings for unmatching printf-type formats 2010-12-21 15:51:07 +01:00