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