Commit Graph

4808 Commits

Author SHA1 Message Date
Jean-Pierre André
ebf35000c9 Fixed computing a file size on Windows
The lower part should not have been sign-extended.
2013-07-30 11:42:59 +02:00
Jean-Pierre André
2c10bd6a98 Fixed struct formats for running on 64-bit Windows
Added a few paddings for field alignment in structs whose layout has to
match 64-bit Windows internals.
2013-07-30 11:31:56 +02:00
Jean-Pierre André
50db448f02 Fixed format translations for Windows
Translating "%ll" print formats to "%I64" for Windows was wrong.
2013-07-30 11:27:16 +02:00
Jean-Pierre André
1120b9c0b0 Removed duplicated code in mkntfs
Removed a meaningless duplicated test.
2013-07-30 11:22:34 +02:00
Jean-Pierre André
e221ad783c Improved emulation of stat(2) on Windows
Made a distinction between a file and a partition when emulating stat(2)
on Windows (useful for ntfsclone).
2013-07-30 11:17:29 +02:00
Jean-Pierre André
0c8e776c12 Silenced a compiler warning in ntfs-3g.probe
Avoid some compilers to complain about a missing return value...
2013-07-30 11:13:51 +02:00
Jean-Pierre André
ad40849149 Forced 64-bit computation of inode number in ntfsundelete
An inode number computation was done with 32 bits, and could (theoretically)
lead to truncation.
2013-07-30 11:07:12 +02:00
Jean-Pierre André
bcbd157cfc Output the modification time when scanning files by ntfsundelete
When trying to undelete a file which was modified several times the
same day, it is difficult to tell which one is the latest unless the
modification time is displayed.
2013-07-30 11:00:46 +02:00
Jean-Pierre André
b60954ff6a Fixed delayed deletion of files opened multiple times in lowntfs-3g
Reworked the delayed deletion of open files in lowntfs-3g to cope with
situations where a file was opened multiple times. In such circumstances,
multiple ghost names are created, to avoid having to check the full list
when opening and closing, which are much more frequent than deleting.
2013-07-30 10:53:07 +02:00
Jean-Pierre André
c8a43e3f9f Improved the manual description of the size option of ntfsresize
Tried to make clear an NTFS file system size is smaller than the
partition size, and the size wanted by ntfsresize is the partition
size.
2013-07-30 10:45:22 +02:00
Jean-Pierre André
397848e21d Reserved a single sector for the backup boot sector
Reserve a single sector, instead of a full cluster, for the backup boot
sector.
2013-07-30 10:35:13 +02:00
Jean-Pierre André
9d730b0da1 Set the backup boot sector in ntfsresize when the size is reliable
Traditionally the backup boot sector is not set by ntfsresize because
the exact partition size is not yet known. A chkdsk is triggered to
subsequently insert it.
However ntfsresize is frequently activated by a partition editor which
has an exact knowledge of the wanted layout, and the backup boot sector
can be inserted by ntfsresize. This is only done if the target partition
size is defined with no unit suffix, and it is a multiple of the sector
size. Anyway the backup boot sector cannot overwrite useful data as it
is inserted between the file system size and the target partition size.
2013-07-30 10:17:28 +02:00
Jean-Pierre André
66cdec13d9 Fixed processing compressed data beyond file size
Windows 8 does not zero any more the end of a compression block beyond
what is needed to reach the end of a file. We must now be careful not
to decompress more data than needed.
2013-05-30 10:23:04 +02:00
Jean-Pierre André
db35a16838 Fixed size truncation when checking for Interix types on 32-bit CPU
A cast, intended to avoid comparing signed to unsigned, led to truncate
the size on a 32-bit CPU, hence to wrongly check for Interix types.
2013-05-07 11:42:48 +02:00
Jean-Pierre André
abba388447 Fixed the reversing of slashes in relative Windows-type symlinks
When translating Windows-type symlinks to Linux ones, the directory
separator has to be changed from '\' to '/'. The change was wrong
for multiple "..\" and ".\"
2013-04-26 19:07:47 +02:00
Jean-Pierre André
be58b3b1f6 Fixed usa checking by ntfsck on 4K sectors
The usa sequence is used to make sure the sectors containing metadata
are fully written. The values are always put at the end of 512-byte
chunks even if the sectors are greater.
2013-04-22 19:14:48 +02:00
Jean-Pierre André
c5a11341b0 Removed obsoleted references to utime_omit_ok
When issuing an utimensat as a consequence of utime(2) or utimensat(2),
fuse had temporarily defined a flag utime_omit_ok to identify whether
the file system supports the values UTIME_OMIT and UTIME_NOW to mean
specific timestamp updatings. The flag has been obsoleted and all
file system are now supposed to comply with the convention.
2013-04-22 19:06:49 +02:00
Jean-Pierre André
baf13fe555 Fixed updating all the MFT runs in a relocated MFT in ntfsresize
When the MFT is partially located beyond the end of a resized partition,
it has to be relocated after the other files have been processed
because the MFT data is needed to do the relocations. When the MFT runlist
is split over extents, all of them have to be processed.
2013-04-22 18:55:26 +02:00
Jean-Pierre André
28cacf40b0 Fixed trying to update the MFT and Bitmap on a test run of ntfsresize
When the beginning of the MFT is beyond the end of the resized
partition, a specific procedure has to be used to relocate this part
of the MFT and adjust the bitmap accordingly. On a test run, these
updates should not be done.
2013-04-22 18:45:48 +02:00
Jean-Pierre André
20801dc6a0 Used /proc/mounts for checking existing mounts
The file /etc/mtab is traditionally checked to avoid multiple mountings
of the same device, but this is not accurate enough in some conditions.
So use /proc/mounts when available and fall back to /etc/mtab on
systems which do not have /proc/mounts.
2013-04-22 18:37:51 +02:00
Jean-Pierre André
b35a204d01 Increased the maximum format size on Windows
The long long printing formats (such as %lld or %llx) have to be
translated to %I64 on older Windows systems, and the buffers to
receive the translated format must be able to hold the tool banners
which can be quite lengthy.
2013-04-22 18:31:16 +02:00
Jean-Pierre André
6aa24b3df3 Fixed a use of uninitialized variable compiler warning
Author: Anton Altaparmakov
Date:   Wed Feb 13 02:29:47 2013 +0000

This is a fix to the use of hd library to get the legacy BIOS geometry.
2013-02-13 08:54:34 +01:00
Jean-Pierre André
0e91e1a9ae Made compilation with --enable-really-static option to ./configure work
Author: Anton Altaparmakov
Date:   Wed Feb 13 02:29:47 2013 +0000

This is a fix to the use of hd library to get the legacy BIOS geometry.
2013-02-13 08:51:47 +01:00
Jean-Pierre André
9442db0d8b Added use of hd library to get the legacy BIOS geometry
Author: Anton Altaparmakov <anton@tuxera.com>
Date:   Tue Feb 12 10:33:55 2013 +0000

    Modify libntfs-3g to make use of hd library to get the legacy BIOS geometry
    from EDD.  We scan all whole disk devices on the system and check if they
    match the open ntfs device and if not we scan all partition devices on the
    system and check if they match the open ntfs device.

    If we find a partition device to match then we find its parent device again
    using the hd library.

    Once we have the parent of the partition device or we matched a whole disk
    device we get the legacy EDD sectors per track and heads again using the hd
    library.

    Use of the hd library is auto detected (based on finding <hd.h> header file,
    being able to link against libhd and finding the hd_list symbol in libhd.

    Use can also be disabled/enabled/libhd prefix specified at ./configure time.
    See ./configure --help for details.

    Note this obviously requires libhd to be installed.  On Ubuntu 12/04 systems
    the relevant packages needed are libhd-dev and libhd16 (on older Ubuntu
    versions it will be libhdN where N is some number <= 16 but an easy way to
    get the right package is to simply install libhd-dev which by dependency
    pulls in the correct libhdN package) whilst on SLES systems the relevant
    packages needed are hwinfo and hwinfo-devel.
2013-02-12 15:45:54 +01:00
Jean-Pierre André
1e625a9563 Made the meaning of the size argument of ntfsresize more clear in the manual
The size argument of ntfsresize is the target partition size. This is
not the file system size as returned by df(1) or statvfs(3) because a
sector is reserved for the backup boot sector, and the remaining sector
count might not be a multiple of clusters per sector.
2013-02-09 15:19:34 +01:00
Jean-Pierre André
2737f9cbd0 Initialize the random generator for the internal guid generator
When uuid/uuid.h is not available, mkntfs uses a home-made guid
generator. Better initialize the random generator to get a random guid.
2013-02-09 15:12:56 +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é
c72b569da1 Ported ntfsundelete to Windows
Made a few adaptations to what is available on Windows.
2013-02-09 14:56:46 +01:00
Jean-Pierre André
c17512cde5 Translated %ll print editing formats to %I64 on Windows
Older msvcrt.dll (on XP and earlier) did not support "%ll" print editing
formats frequently used by ntfsclone. So translate them to "%I64" when
running on Windows. This format appears to be supported by all Windows
versions. Error messages from libntfs-3g are still not translated.
2013-02-09 12:57:22 +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é
2e2550026e Avoided displaying in non-verbose mode information which is not computed
The summary of 'runcount.runs' and 'runcount.fragments' was displayed in
non-verbose mode. However these variables are not updated in non-verbose
mode, so they would always be 0.
We now only display this summary in verbose mode.
2013-02-09 12:08:58 +01:00
Jean-Pierre André
aebfcf3d27 Enabled relocating the MFT when shrinking a volume
This patch makes it possible to shrink a volume to a small size such that
the existing $MFT is beyond the new size.
2013-02-09 12:00:02 +01:00
Jean-Pierre André
b2e1dbbf38 Made possible to run ntfsundelete on systems with no regex.h
The filtering of files to undelete is usually done through the regex
library. This patch offers an alternate way when such a library is
not readily available (typically on Windows).
2013-02-09 11:56:09 +01:00
Jean-Pierre André
c972652876 Avoided meaningless errors logging during ntfsundelete scans
When ntfsundelete scans the $MFT for possible deleted files, it may
examine extries which have never been used, producing error messages
which most users do not understand. This patch silences such messages.
2013-02-09 11:51:40 +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é
412f09d87d Fixed the ntfsfix option for testing in the manual
The option for checking the behavior of ntfsfix without writing anything
is "--no-action", not "--do-nothing".
2013-02-09 11:33:17 +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é
44fbf02a97 Upgraded the Win32 interface for use with ntfsprogs
Upgrade the Win32 interface (win32_io.c) which was designed for Cygwin
so that it can be used for using the ntfsprogs utilities on native Windows.
Two new entries are added for truncating a file and creating a sparse
file, both of which not being supported through msvcrt.dll.
2013-02-09 11:22:41 +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
Jean-Pierre André
6caa1b0bda Added directions for getting a user mapping proposal through secaudit
The definition of the user mapping needed to interoperate permissions
with Windows is too complex for most users. Even the "usermap" utility
is too complex. This patch adds explanations for using the "-u" option
of secaudit to get a user mapping proposal
2013-02-09 11:06:39 +01:00
Szabolcs Szakacsits
d3dad801b3 Version 2012.1.13 2013-01-13 08:31:50 +02: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