Copyright (c) 2005 Richard Russon.
Copyright (c) 2011-2013 Jean-Pierre Andre.
This file may be copied under the terms of the GNU Public License.
ntfsresize [OPTIONS] [--size SIZE[k|M|G]] DEVICE
Ntfsresize can be used to shrink or enlarge any NTFS filesystem located on an unmounted DEVICE (usually a disk partition). The new filesystem will fit in a DEVICE whose desired size is SIZE bytes. The SIZE parameter may have one of the optional modifiers k , M , G , which means the SIZE parameter is given in kilo-, mega- or gigabytes respectively. Ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. If both --info(-mb-only) and --size are omitted then the NTFS filesystem will be enlarged to match the underlying DEVICE size.
To resize a filesystem on a partition, you must resize BOTH the filesystem and the partition by editing the partition table on the disk. Similarly to other command line filesystem resizers, ntfsresize doesn't manipulate the size of the partitions, hence to do that you must use a disk partitioning tool as well, for example fdisk (8). Alternatively you could use one of the many user friendly partitioners that uses ntfsresize internally, like Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner, IBM's EVMS, GParted or Debian/Ubuntu's Partman.
IMPORTANT! It's a good practice making REGULAR BACKUPS of your valuable data, especially before using ANY partitioning tools. To do so for NTFS, you could use ntfsclone (8). Don't forget to save the partition table as well!
-c, --check By using this option ntfsresize will only check the device to ensure that it is ready to be resized. If not, it will print any errors detected. If the device is fine, nothing will be printed.
-i, --info By using this option without --expand, ntfsresize will determine the theoretically smallest shrunken filesystem size supported. Most of the time the result is the space already used on the filesystem. Ntfsresize will refuse shrinking to a smaller size than what you got by this option and depending on several factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the --no-action option before real resizing. Practically the smallest shrunken size generally is at around "used space" + (20-200 MB). Please also take into account that Windows might need about 50-100 MB free space left to boot safely. If used in association with option --expand, ntfsresize will determine the smallest downwards expansion size and the possible increments to the size. These are exact byte counts which must not be rounded. This option may be used after the partition has been expanded provided the upper bound has not been changed. This option never causes any changes to the filesystem, the partition is opened read-only.
-m, --info-mb-only Like the info option, only print out the shrinkable size in MB. Print nothing if the shrink size is the same as the original size (in MB). This option cannot be used in association with option --expand.
-s, --size SIZE[k|M|G] Resize filesystem to fit in a partition whose size is SIZE[k|M|G] bytes by shifting its end and keeping its beginning unchanged. The filesystem size is set to be at least one sector smaller than the partition. The optional modifiers k , M , G mean the SIZE parameter is given in kilo-, mega- or gigabytes respectively. Conforming to standards, k=10^3, M=10^6 and G=10^9. ki=2^10, Mi=2^20 and Gi=2^30 are also allowed. Use this option with --no-action first.
-x, --expand Expand the filesystem to the current partition size, shifting down its beginning and keeping its end unchanged. The metadata is recreated in the expanded space and no user data is relocated. This is incompatible with option -s (or --size) and can only be made if the expanded space is an exact multiple of the cluster size. It must also be large enough to hold the new metadata. If the expansion is interrupted for some reason (power outage, etc), you may restart the resizing, as the original data and metadata have been kept unchanged. Note : expanding a Windows system partition and filesystem downwards may lead to the registry or some files not matching the new system layout, or to some important files being located too far from the beginning of the partition, thus making Windows not bootable.
-f, --force Forces ntfsresize to proceed with the resize operation either without prompting for an explicit acceptance, or if the filesystem is marked for consistency check. Double the option (-ff, --force --force) to avoid prompting even if the file system is marked for check. Please note, ntfsresize always marks the filesystem for consistency check before a real resize operation and it leaves that way for extra safety. Thus if NTFS was marked by ntfsresize then it's safe to use this option. If you need to resize several times without booting into Windows between each resizing steps then you must use this option.
-n, --no-action Use this option to make a test run before doing the real resize operation. Volume will be opened read-only and ntfsresize displays what it would do if it were to resize the filesystem. Continue with the real resizing only if the test run passed.
-b, --bad-sectors Support disks having hardware errors, bad sectors with those ntfsresize would refuse to work by default. Prior using this option, it's strongly recommended to make a backup by ntfsclone (8) using the --rescue option, then running 'chkdsk /f /r volume:' on Windows from the command line. If the disk guarantee is still valid then replace it. It's defected. Please also note, that no software can repair these type of hardware errors. The most what they can do is to work around the permanent defects. This option doesn't have any effect if the disk is flawless.
-P, --no-progress-bar Don't show progress bars.
-v, --verbose More output.
-V, --version Print the version number of ntfsresize and exit.
-h, --help Display help and exit.
ntfs-3g-devel@lists.sf.net
There are a few very rarely met restrictions at present: filesystems having unknown bad sectors, relocation of the first MFT extent and resizing into the middle of a $MFTMirr extent aren't supported yet. These cases are detected and resizing is restricted to a safe size or the closest safe size is displayed.
Ntfsresize schedules an NTFS consistency check and after the first boot into Windows you must see chkdsk running on a blue background. This is intentional and no need to worry about it. Windows may force a quick reboot after the consistency check. Moreover after repartitioning your disk and depending on the hardware configuration, the Windows message System Settings Change may also appear. Just acknowledge it and reboot again.
The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed in an incompatible way in Linux 2.6 kernels and this triggered multitudinous partition table corruptions resulting in unbootable Windows systems, even if NTFS was consistent, if parted (8) was involved in some way. This problem was often attributed to ntfsresize but in fact it's completely independent of NTFS thus ntfsresize. Moreover ntfsresize never touches the partition table at all. By changing the 'Disk Access Mode' to LBA in the BIOS makes booting work again, most of the time. You can find more information about this issue in the Troubleshooting section of the below referred Ntfsresize FAQ.
https://github.com/tuxera/ntfs-3g/wiki/