|Skip Navigation Links|
|Exit Print View|
|man pages section 1M: System Administration Commands Oracle Solaris 11 Information Library|
- resize an NTFS file system without data loss
ntfsresize [options] --info device
ntfsresize [options] [--size size[k|M|G]] device
The ntfsresize program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions used by 32-bit and 64-bit Windows “operating systems” are supported. Defragmentation is not required prior to resizing, because ntfsresize can relocate any data if needed, without risking data integrity.
ntfsresize can be used to shrink or enlarge any NTFS file system located on an unmounted device (usually a disk partition). The new file system will have a size that you specify. The size parameter can have one of the optional modifiers k, M, G, denoting, respectively, kilobytes, megabytes, or gigabytes. ntfsresize conforms to the SI, ATA, an IEEE standards and the disk manufacturers by supporting k=103, M=106 and G=109.
If both ---info and ---size options are omitted then the NTFS file system will be enlarged to the underlying device size.
To resize a file system on a partition, you must resize both the file system and the partition, by editing the partition table on the disk. Similarly to other command-line file system resizers, ntfsresize does not manipulate the size of the partitions. To do that you must use a disk partitioning tool, such as fdisk(1M). Alternatively, you could use one of the many user friendly partitioners that uses ntfsresize internally. Such partitioners include, among others, Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner, IBM's EVMS, GParted, or Debian/Ubuntu's Partman.
Back up your data and your partition table before using any partitioning tool. For an NTFS file system, you can use ntfsclone(1M) as a means of backup.
To shrink an NTFS partition, first use ntfsresize to shrink the size of the file system. Then use a utility such as fdisk(1M) to shrink the size of the partition by deleting the partition and recreating it with the smaller size. Do not make the partition smaller than the new size of NTFS; otherwise, you will not be able to boot from that partition. If you mistakenly made a too-small partition, you would have to recreate the partition to be as large as newly sized NTFS file system.
To enlarge an NTFS file system, you must first enlarge the size of the underlying partition. You can use fdisk(1M) to delete the partition and recreate it with a larger size. Make sure the newly sized partition does not overlap with any other partition. Then use ntfsresize to enlarge the file system.
When recreating a partition, make sure you create it at the same starting sector and with the same partition type as was used in the partition you are replacing. Otherwise, you will not be able to access your file system. Use the fdisk u command to switch from the default cylinder unit to the reliable sector unit. Also, if the bootable flag was set in the old partition, make sure to set it in the recreated partiton. Otherwise, you might not be able to boot from the new partition.
There are a handful of very rarely met restrictions in the use of ntfsresize. An example of such a restriction occurs with a file system stored on a disk having unknown bad sectors. Relocation of the first MFT extent and resizing into the middle of a $MFTMirr extent are not supported. These cases are detected and resizing is restricted to a safe size or the closest safe size is displayed.
Upon completion of a resizing, ntfsresize schedules an NTFS consistency check. In Windows, this check is performed by chkdsk. Upon the first subsequent reboot into Windows, you will note chkdsk running in a blue background. This is normal. Windows might force a quick reboot after the consistency check. Depending on your hardware configuration, Windows might alert you to a systems setting change and recommend or require a reboot. Acknowledge the message and reboot a second time.
Supported options are listed below. Most options have both single-letter and full-name forms. Multiple single-letter options that do not take an argument can be combined. For example, -fv is the equivalent of -f -v. A full-name option can be abbreviated to a unique prefix of its name.
By default, ntfsresize exits upon encountering bad sectors. This option allows the utility to proceed in spite of such sectors.
Prior using this option, it is strongly recommended that you use ntfsclone(1M) with the --rescue option to make a backup, then, in Windows, run chkdsk /f /r volume: from the command line. If the disk guarantee displays as valid, then replace it, as it is defective. Note that no software can repair bad sector errors. The most that can be done is to work around these defects.
This option has no effect if a disk has no bad sectors.
ntfsresize always marks a file system for consistency check before a real (not using -–no-action) resize operation and it leaves that way for extra safety. Thus, if an NTFS file system was marked by ntfsresize, it is safe to use this option. You must use this option, if you need to resize several times without booting into Windows between each resizing step.
Display usage information and exit.
Used when you want to shrink a file system. Causes ntfsresize to determine the smallest shrunken file system size supported. Most of the time the smallest size is the space already used on the file system. ntfsresize does not shrink a file system to a smaller size than what is returned by this option. Depending on several factors, it might be unable to shrink to this theoretical size. Although the integrity of your data should be never at risk, it is nevertheless strongly recommended to make a test run by using the --no-action option before actual resizing.
Based on testing, the smallest attainable size is approximately space used in the file system plus 20–200 MB. Note also that Windows might need an additional 50–100 MB to boot safely.
This option never causes any changes to the file system; the partition is opened read-only.
Use this option to make a test run before doing the resize operation. Volume will be opened read-only and ntfsresize displays what it would do if it were to resize the file system. Proceed with the actual resizing only if the test run passed.
Do not display progress bars during ntfsresize operation.
Resize file system to size bytes. The new file system will have a size that you specify. The size parameter can have one of the optional modifiers k, M, G, denoting, respectively, kilobytes, megabytes, or gigabytes. ntfsresize conforms to the SI, ATA, an IEEE standards and the disk manufacturers by supporting k=103, M=106 and G=109. Before performing an actual resizing, run ntfsresize with the --no-action option, along with this option, first.
Display copious output.
Display the version number of ntfsresize.
Display zero on success, non-zero otherwise.
See attributes(5) for descriptions of the following attributes:
In Linux version 2.6, with partitions that have been manipulated by parted(1M), use of ntfsresize preceded corruption of partition tables, which resulted in unbootable Windows systems. This occurred even if the NTFS file system was consistent. This problem is independent of NTFS and, thus, ntfsresize. Moreover, ntfsresize never touches the partition table. Under the conditions just described, you can, in the BIOS, change Disk Access Mode to LBA to regain the ability to boot. For further discussion of this condition see the ntfsresize FAQ at: http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html.
ntfsresize was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov and Richard Russon.