ntfs-3g/ntfsprogs/ntfsresize.8.in

328 lines
12 KiB
Groff
Raw Normal View History

2006-01-08 06:21:25 +08:00
.\" Copyright (c) 2002\-2006 Szabolcs Szakacsits.
.\" Copyright (c) 2005 Richard Russon.
2014-02-17 01:25:09 +08:00
.\" Copyright (c) 2011\-2013 Jean-Pierre Andre.
.\" This file may be copied under the terms of the GNU Public License.
2002-11-29 20:16:35 +08:00
.\"
2014-02-17 01:25:09 +08:00
.TH NTFSRESIZE 8 "July 2013" "ntfs-3g @VERSION@"
2002-11-29 20:16:35 +08:00
.SH NAME
ntfsresize \- resize an NTFS filesystem without data loss
2002-11-29 20:16:35 +08:00
.SH SYNOPSIS
.B ntfsresize
[\fIOPTIONS\fR]
.B \-\-info(\-mb\-only)
.I DEVICE
.br
.B ntfsresize
[\fIOPTIONS\fR]
[\fB\-\-size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]]
.I DEVICE
2002-11-29 20:16:35 +08:00
.SH DESCRIPTION
The
.B ntfsresize
2005-11-22 08:17:23 +08:00
program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows
2005-06-12 21:39:23 +08:00
NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are
supported, used by 32\-bit and 64\-bit Windows.
2005-11-22 08:17:23 +08:00
.B Defragmentation is NOT required prior to resizing
because the program can relocate any data if needed, without risking data
2005-06-12 21:39:23 +08:00
integrity.
.PP
Ntfsresize can be used to shrink or enlarge any NTFS filesystem located
on an unmounted
.I DEVICE
(usually a disk partition). The new filesystem will fit in a DEVICE
whose desired size is
.I SIZE
2002-11-29 20:16:35 +08:00
bytes.
The
.I SIZE
2002-11-29 20:16:35 +08:00
parameter may have one of the optional modifiers
.BR k ,
.BR M ,
.BR G ,
which means the
.I SIZE
parameter is given in kilo\-, mega\- or gigabytes respectively.
2005-06-12 21:39:23 +08:00
.B Ntfsresize
2002-12-02 02:54:13 +08:00
conforms to the SI, ATA, IEEE standards and the disk manufacturers
2002-11-29 20:16:35 +08:00
by using k=10^3, M=10^6 and G=10^9.
2006-01-08 06:21:25 +08:00
2005-11-22 08:17:23 +08:00
If both
.B \-\-info(\-mb\-only)
and
.B \-\-size
2005-11-22 08:17:23 +08:00
are omitted then the
NTFS filesystem will be enlarged to match the underlying
2005-11-22 08:17:23 +08:00
.I DEVICE
size.
2002-11-29 20:16:35 +08:00
.PP
2005-06-12 21:39:23 +08:00
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,
2002-11-29 20:16:35 +08:00
.B ntfsresize
2005-06-12 21:39:23 +08:00
doesn't manipulate the size of the partitions, hence
to do that you must use a disk partitioning tool as well, for example
.BR fdisk (8).
2005-06-12 21:39:23 +08:00
Alternatively you could use one of the many user friendly partitioners that
2005-11-22 08:17:23 +08:00
uses
2005-06-12 21:39:23 +08:00
.B ntfsresize
internally, like Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner,
IBM's EVMS, GParted or Debian/Ubuntu's Partman.
.PP
.B IMPORTANT!
2005-11-22 08:17:23 +08:00
It's a good practice making REGULAR BACKUPS of your valuable data, especially
2005-06-12 21:39:23 +08:00
before using ANY partitioning tools. To do so for NTFS, you could use
2005-11-22 08:17:23 +08:00
.BR ntfsclone (8).
2005-06-12 21:39:23 +08:00
Don't forget to save the partition table as well!
.SS Shrinkage
2002-11-29 20:16:35 +08:00
If you wish to shrink an NTFS partition, first use
.B ntfsresize
2005-06-12 21:39:23 +08:00
to shrink the size of the filesystem. Then you could use
2002-11-29 20:16:35 +08:00
.BR fdisk (8)
to shrink the size of the partition by deleting the
2002-12-02 02:54:13 +08:00
partition and recreating it with the smaller size.
2005-11-22 08:17:23 +08:00
Do not make the partition smaller than the new size of
NTFS otherwise you won't be able to boot. If you did so notwithstanding
2005-06-12 21:39:23 +08:00
then just recreate the partition to be as large as NTFS.
.SS Enlargement
To enlarge an NTFS filesystem, first you must enlarge the size of the
2005-11-22 08:17:23 +08:00
underlying partition. This can be done using
2002-11-29 20:16:35 +08:00
.BR fdisk (8)
by deleting the partition and recreating it with a larger size.
Make sure it will not overlap with an other existing partition.
You may enlarge upwards (first sector unchanged) or downwards (last
sector unchanged), but you may not enlarge at both ends in a single step.
If you merge two NTFS partitions, only one of them can be expanded to the
merged partition.
After you have enlarged the partition, you may use
.B ntfsresize
to enlarge the size of the filesystem.
.SS Partitioning
When recreating the partition by a disk partitioning tool,
2005-11-22 08:17:23 +08:00
make sure you create it at the same
starting sector and with the same partition type as before.
Otherwise you won't be able to access your filesystem. Use the 'u'
2005-11-22 08:17:23 +08:00
fdisk command to switch to the reliable sector unit from the
default cylinder one.
2006-01-08 06:21:25 +08:00
2002-11-29 20:16:35 +08:00
Also make sure you set the bootable flag for the partition if it
existed before. Failing to do so you might not be able to boot your
computer from the disk.
2002-11-29 20:16:35 +08:00
.SH OPTIONS
Below is a summary of all the options that
2002-11-29 20:16:35 +08:00
.B ntfsresize
accepts. Nearly all options have two equivalent names. The short name is
preceded by
.B \-
and the long name is preceded by
.BR \-\- .
Any single letter options, that don't take an argument, can be combined into a
single command, e.g.
.B \-fv
is equivalent to
.BR "\-f \-v" .
Long named options can be abbreviated to any unique prefix of their name.
2002-11-29 20:16:35 +08:00
.TP
\fB\-c\fR, \fB\-\-check\fR
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.
.TP
\fB\-i\fR, \fB\-\-info\fR
By using this option without \fB\-\-expand\fP, ntfsresize will determine the
theoretically smallest shrunken filesystem size supported.
Most of the time the result is the space
2005-11-22 08:17:23 +08:00
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
\fB\-\-no\-action\fR option before real resizing.
Practically the smallest shrunken size generally is
2005-11-22 08:17:23 +08:00
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 \fB\-\-expand\fP, 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.
2002-11-29 20:16:35 +08:00
.TP
\fB\-m\fR, \fB\-\-info\-mb\-only\fR
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 \fB\-\-expand\fP.
.TP
\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]
Resize filesystem to fit in a partition whose size is
\fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] 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
.BR k ,
.BR M ,
.B G
mean the
.I 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
.B \-\-no\-action
first.
2002-11-29 20:16:35 +08:00
.TP
\fB\-x\fR, \fB\-\-expand\fR
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.
.TP
\fB\-f\fR, \fB\-\-force\fR
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.
2006-01-08 06:21:25 +08:00
Please note, ntfsresize always marks the filesystem
2005-11-22 08:17:23 +08:00
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.
.TP
.B \-n, \-\-no\-action
Use this option to make a test run before doing the real resize operation.
Volume will be opened read\-only and
2002-11-29 20:16:35 +08:00
.B ntfsresize
2005-11-22 08:17:23 +08:00
displays what it would do if it were to resize the filesystem.
Continue with the real resizing only if the test run passed.
2002-11-29 20:16:35 +08:00
.TP
\fB\-b\fR, \fB\-\-bad\-sectors\fR
2005-08-16 05:44:10 +08:00
Support disks having hardware errors, bad sectors with those
.B ntfsresize
2005-11-22 08:17:23 +08:00
would refuse to work by default.
2006-01-08 06:21:25 +08:00
2005-08-16 05:44:10 +08:00
Prior using this option, it's strongly recommended to make a backup by
.BR ntfsclone (8)
2005-11-22 08:17:23 +08:00
using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows
2005-08-16 05:44:10 +08:00
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
2005-11-22 08:17:23 +08:00
hardware errors. The most what they can do is to work around the permanent
2005-08-16 05:44:10 +08:00
defects.
2006-01-08 06:21:25 +08:00
2005-08-16 05:44:10 +08:00
This option doesn't have any effect if the disk is flawless.
.TP
\fB\-P\fR, \fB\-\-no\-progress\-bar\fR
Don't show progress bars.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
More output.
.TP
\fB\-V\fR, \fB\-\-version\fR
Print the version number of
.B ntfsresize
and exit.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help and exit.
.SH EXIT CODES
2005-11-22 08:17:23 +08:00
The exit code is 0 on success, non\-zero otherwise.
2006-01-08 06:21:25 +08:00
.SH KNOWN ISSUES
2005-11-22 08:17:23 +08:00
No reliability problem is known. If you need
help please try the Ntfsresize FAQ first (see below) and if you
don't find your answer then send your question, comment or bug report to
the development team:
.br
.nh
ntfs\-3g\-devel@lists.sf.net
.hy
2002-11-29 20:16:35 +08:00
.PP
2005-11-22 08:17:23 +08:00
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
2005-11-22 08:17:23 +08:00
aren't supported yet. These cases are detected and
resizing is restricted to a safe size or the closest safe
size is displayed.
.PP
2005-06-12 21:39:23 +08:00
.B Ntfsresize
schedules an NTFS consistency check and
after the first boot into Windows you must see
2005-11-22 08:17:23 +08:00
.B 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.
2005-11-22 08:17:23 +08:00
Moreover after repartitioning your disk and depending on the
hardware configuration, the Windows message
.B System Settings Change
may also appear. Just acknowledge it and reboot again.
2005-06-12 21:39:23 +08:00
.PP
2005-11-22 08:17:23 +08:00
The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed
in an incompatible way in Linux 2.6 kernels and this triggered multitudinous
2005-10-28 23:14:49 +08:00
partition table corruptions resulting in unbootable Windows systems, even if
2005-11-22 08:17:23 +08:00
NTFS was consistent, if
2005-06-12 21:39:23 +08:00
.BR parted (8)
2005-11-22 08:17:23 +08:00
was involved in some way. This problem was often attributed to ntfsresize
but in fact it's completely independent of NTFS thus ntfsresize. Moreover
2005-06-12 21:39:23 +08:00
ntfsresize never touches the partition table at all. By changing
2005-11-22 08:17:23 +08:00
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.
.SH AUTHORS
.B ntfsresize
was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov
and Richard Russon.
It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
2002-11-29 20:16:35 +08:00
.SH ACKNOWLEDGEMENT
Many thanks to Anton Altaparmakov and Richard Russon
2005-11-22 08:17:23 +08:00
for libntfs, the excellent documentation and comments,
to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues
at the University of Granada for their continuous and highly valuable help,
furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal,
Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick
for beta testing the relocation support, to Florian Eyben, Fritz Oppliger,
Richard Ebling, Sid\-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher
2006-02-12 09:30:34 +08:00
Haney, Ryan Durk, Ralf Beyer, Scott Hansen, Alan Evans for the valued
2005-11-22 08:17:23 +08:00
contributions and to Theodore Ts'o whose
2002-11-29 20:16:35 +08:00
.BR resize2fs (8)
man page originally formed the basis of this page.
2002-11-29 23:26:49 +08:00
.SH AVAILABILITY
.B ntfsresize
is part of the
.B ntfs-3g
package and is available from:
.br
.nh
http://www.tuxera.com/community/
.hy
.sp
2005-06-12 21:39:23 +08:00
.B Ntfsresize
2005-11-22 08:17:23 +08:00
related news, example of usage, troubleshooting, statically linked binary and
FAQ (frequently asked questions) are maintained at:
.br
.nh
http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html
.hy
2002-11-29 20:16:35 +08:00
.SH SEE ALSO
.BR fdisk (8),
.BR cfdisk (8),
.BR sfdisk (8),
.BR parted (8),
2005-06-12 21:39:23 +08:00
.BR evms (8),
.BR ntfsclone (8),
2005-06-12 21:39:23 +08:00
.BR mkntfs (8),
2002-11-29 23:26:49 +08:00
.BR ntfsprogs (8)