summaryrefslogtreecommitdiff
path: root/ntfsprogs/ntfsresize.8.in (plain)
blob: 6927cc4b92a89bc18f10703bedebca2569bf2db6
1.\" Copyright (c) 2002\-2006 Szabolcs Szakacsits.
2.\" Copyright (c) 2005 Richard Russon.
3.\" This file may be copied under the terms of the GNU Public License.
4.\"
5.TH NTFSRESIZE 8 "February 2006" "ntfs-3g @VERSION@"
6.SH NAME
7ntfsresize \- resize an NTFS filesystem without data loss
8.SH SYNOPSIS
9.B ntfsresize
10[\fIOPTIONS\fR]
11.B \-\-info(\-mb\-only)
12.I DEVICE
13.br
14.B ntfsresize
15[\fIOPTIONS\fR]
16[\fB\-\-size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]]
17.I DEVICE
18.SH DESCRIPTION
19The
20.B ntfsresize
21program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows
22NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are
23supported, used by 32\-bit and 64\-bit Windows.
24.B Defragmentation is NOT required prior to resizing
25because the program can relocate any data if needed, without risking data
26integrity.
27.PP
28Ntfsresize can be used to shrink or enlarge any NTFS filesystem located
29on an unmounted
30.I DEVICE
31(usually a disk partition). The new filesystem will fit in a DEVICE
32whose desired size is
33.I SIZE
34bytes.
35The
36.I SIZE
37parameter may have one of the optional modifiers
38.BR k ,
39.BR M ,
40.BR G ,
41which means the
42.I SIZE
43parameter is given in kilo\-, mega\- or gigabytes respectively.
44.B Ntfsresize
45conforms to the SI, ATA, IEEE standards and the disk manufacturers
46by using k=10^3, M=10^6 and G=10^9.
47
48If both
49.B \-\-info(\-mb\-only)
50and
51.B \-\-size
52are omitted then the
53NTFS filesystem will be enlarged to match the underlying
54.I DEVICE
55size.
56.PP
57To resize a filesystem on a partition, you must resize BOTH the filesystem
58and the partition by editing the partition table on the disk. Similarly to
59other command line filesystem resizers,
60.B ntfsresize
61doesn't manipulate the size of the partitions, hence
62to do that you must use a disk partitioning tool as well, for example
63.BR fdisk (8).
64Alternatively you could use one of the many user friendly partitioners that
65uses
66.B ntfsresize
67internally, like Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner,
68IBM's EVMS, GParted or Debian/Ubuntu's Partman.
69.PP
70.B IMPORTANT!
71It's a good practice making REGULAR BACKUPS of your valuable data, especially
72before using ANY partitioning tools. To do so for NTFS, you could use
73.BR ntfsclone (8).
74Don't forget to save the partition table as well!
75.SS Shrinkage
76If you wish to shrink an NTFS partition, first use
77.B ntfsresize
78to shrink the size of the filesystem. Then you could use
79.BR fdisk (8)
80to shrink the size of the partition by deleting the
81partition and recreating it with the smaller size.
82Do not make the partition smaller than the new size of
83NTFS otherwise you won't be able to boot. If you did so notwithstanding
84then just recreate the partition to be as large as NTFS.
85.SS Enlargement
86To enlarge an NTFS filesystem, first you must enlarge the size of the
87underlying partition. This can be done using
88.BR fdisk (8)
89by deleting the partition and recreating it with a larger size.
90Make sure it will not overlap with an other existing partition.
91You may enlarge upwards (first sector unchanged) or downwards (last
92sector unchanged), but you may not enlarge at both ends in a single step.
93If you merge two NTFS partitions, only one of them can be expanded to the
94merged partition.
95After you have enlarged the partition, you may use
96.B ntfsresize
97to enlarge the size of the filesystem.
98.SS Partitioning
99When recreating the partition by a disk partitioning tool,
100make sure you create it at the same
101starting sector and with the same partition type as before.
102Otherwise you won't be able to access your filesystem. Use the 'u'
103fdisk command to switch to the reliable sector unit from the
104default cylinder one.
105
106Also make sure you set the bootable flag for the partition if it
107existed before. Failing to do so you might not be able to boot your
108computer from the disk.
109.SH OPTIONS
110Below is a summary of all the options that
111.B ntfsresize
112accepts. Nearly all options have two equivalent names. The short name is
113preceded by
114.B \-
115and the long name is preceded by
116.BR \-\- .
117Any single letter options, that don't take an argument, can be combined into a
118single command, e.g.
119.B \-fv
120is equivalent to
121.BR "\-f \-v" .
122Long named options can be abbreviated to any unique prefix of their name.
123.TP
124\fB\-c\fR, \fB\-\-check\fR
125By using this option ntfsresize will only check the device to ensure that it
126is ready to be resized. If not, it will print any errors detected.
127If the device is fine, nothing will be printed.
128.TP
129\fB\-i\fR, \fB\-\-info\fR
130By using this option without \fB\-\-expand\fP, ntfsresize will determine the
131theoretically smallest shrunken filesystem size supported.
132Most of the time the result is the space
133already used on the filesystem. Ntfsresize will refuse shrinking to a
134smaller size than what you got by this option and depending on several
135factors it might be unable to shrink very close to this theoretical
136size. Although the integrity of your data should be never in risk,
137it's still strongly recommended to make a test run by using the
138\fB\-\-no\-action\fR option before real resizing.
139
140Practically the smallest shrunken size generally is
141at around "used space" + (20\-200 MB). Please also take into account
142that Windows might need about 50\-100 MB free space left to boot safely.
143
144If used in association with option \fB\-\-expand\fP, ntfsresize will determine
145the smallest downwards expansion size and the possible increments to the
146size. These are exact byte counts which must not be rounded.
147This option may be used after the partition has been expanded
148provided the upper bound has not been changed.
149
150This option never causes any changes to the filesystem, the partition is
151opened read\-only.
152.TP
153\fB\-m\fR, \fB\-\-info\-mb\-only\fR
154Like the info option, only print out the shrinkable size in MB. Print nothing
155if the shrink size is the same as the original size (in MB).
156This option cannot be used in association with option \fB\-\-expand\fP.
157.TP
158\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]
159Resize filesystem to fit in a partition whose size is
160\fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes by shifting its end and keeping
161its beginning unchanged. The filesystem size is set to be at least one
162sector smaller than the partition.
163The optional modifiers
164.BR k ,
165.BR M ,
166.B G
167mean the
168.I SIZE
169parameter is given in kilo\-, mega\- or gigabytes respectively.
170Conforming to standards, k=10^3, M=10^6 and G=10^9. ki=2^10, Mi=2^20
171and Gi=2^30 are also allowed. Use this option
172with
173.B \-\-no\-action
174first.
175.TP
176\fB\-x\fR, \fB\-\-expand\fR
177Expand the filesystem to the current partition size, shifting down its
178beginning and keeping its end unchanged. The metadata is recreated in the
179expanded space and no user data is relocated. This is incompatible with
180option \-s (or \-\-size) and can only be made if the expanded space is an
181exact multiple of the cluster size. It must also be large enough to hold the
182new metadata.
183
184If the expansion is interrupted for some reason (power outage, etc), you may
185restart the resizing, as the original data and metadata have been kept
186unchanged.
187
188Note : expanding a Windows system partition and filesystem downwards may lead
189to the registry or some files not matching the new system layout, or to
190some important files being located too far from the beginning of the
191partition, thus making Windows not bootable.
192.TP
193\fB\-f\fR, \fB\-\-force\fR
194Forces ntfsresize to proceed with the resize operation either without
195prompting for an explicit acceptance, or if the filesystem is marked for
196consistency check. Double the option (-ff, --force --force) to avoid
197prompting even if the file system is marked for check.
198
199Please note, ntfsresize always marks the filesystem
200for consistency check before a real resize operation
201and it leaves that way for extra
202safety. Thus if NTFS was marked by ntfsresize then it's safe to
203use this option. If you need
204to resize several times without booting into Windows between each
205resizing steps then you must use this option.
206.TP
207.B \-n, \-\-no\-action
208Use this option to make a test run before doing the real resize operation.
209Volume will be opened read\-only and
210.B ntfsresize
211displays what it would do if it were to resize the filesystem.
212Continue with the real resizing only if the test run passed.
213.TP
214\fB\-b\fR, \fB\-\-bad\-sectors\fR
215Support disks having hardware errors, bad sectors with those
216.B ntfsresize
217would refuse to work by default.
218
219Prior using this option, it's strongly recommended to make a backup by
220.BR ntfsclone (8)
221using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows
222from the command line. If the disk guarantee is still valid then replace it.
223It's defected. Please also note, that no software can repair these type of
224hardware errors. The most what they can do is to work around the permanent
225defects.
226
227This option doesn't have any effect if the disk is flawless.
228.TP
229\fB\-P\fR, \fB\-\-no\-progress\-bar\fR
230Don't show progress bars.
231.TP
232\fB\-v\fR, \fB\-\-verbose\fR
233More output.
234.TP
235\fB\-V\fR, \fB\-\-version\fR
236Print the version number of
237.B ntfsresize
238and exit.
239.TP
240\fB\-h\fR, \fB\-\-help\fR
241Display help and exit.
242.SH EXIT CODES
243The exit code is 0 on success, non\-zero otherwise.
244.SH KNOWN ISSUES
245No reliability problem is known. If you need
246help please try the Ntfsresize FAQ first (see below) and if you
247don't find your answer then send your question, comment or bug report to
248the development team:
249.br
250.nh
251ntfs\-3g\-devel@lists.sf.net
252.hy
253.PP
254There are a few very rarely met restrictions at present: filesystems having
255unknown bad sectors, relocation
256of the first MFT extent and resizing into the middle of a $MFTMirr extent
257aren't supported yet. These cases are detected and
258resizing is restricted to a safe size or the closest safe
259size is displayed.
260.PP
261.B Ntfsresize
262schedules an NTFS consistency check and
263after the first boot into Windows you must see
264.B chkdsk
265running on a blue background. This is intentional and no need to worry about it.
266Windows may force a quick reboot after the consistency check.
267Moreover after repartitioning your disk and depending on the
268hardware configuration, the Windows message
269.B System Settings Change
270may also appear. Just acknowledge it and reboot again.
271.PP
272The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed
273in an incompatible way in Linux 2.6 kernels and this triggered multitudinous
274partition table corruptions resulting in unbootable Windows systems, even if
275NTFS was consistent, if
276.BR parted (8)
277was involved in some way. This problem was often attributed to ntfsresize
278but in fact it's completely independent of NTFS thus ntfsresize. Moreover
279ntfsresize never touches the partition table at all. By changing
280the 'Disk Access Mode' to LBA in the BIOS makes booting work
281again, most of the time. You can find more information about this issue
282in the Troubleshooting section of the below referred Ntfsresize FAQ.
283.SH AUTHORS
284.B ntfsresize
285was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov
286and Richard Russon.
287It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
288.SH ACKNOWLEDGEMENT
289Many thanks to Anton Altaparmakov and Richard Russon
290for libntfs, the excellent documentation and comments,
291to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues
292at the University of Granada for their continuous and highly valuable help,
293furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal,
294Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick
295for beta testing the relocation support, to Florian Eyben, Fritz Oppliger,
296Richard Ebling, Sid\-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher
297Haney, Ryan Durk, Ralf Beyer, Scott Hansen, Alan Evans for the valued
298contributions and to Theodore Ts'o whose
299.BR resize2fs (8)
300man page originally formed the basis of this page.
301.SH AVAILABILITY
302.B ntfsresize
303is part of the
304.B ntfs-3g
305package and is available from:
306.br
307.nh
308http://www.tuxera.com/community/
309.hy
310.sp
311.B Ntfsresize
312related news, example of usage, troubleshooting, statically linked binary and
313FAQ (frequently asked questions) are maintained at:
314.br
315.nh
316http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html
317.hy
318.SH SEE ALSO
319.BR fdisk (8),
320.BR cfdisk (8),
321.BR sfdisk (8),
322.BR parted (8),
323.BR evms (8),
324.BR ntfsclone (8),
325.BR mkntfs (8),
326.BR ntfsprogs (8)
327