1 '\" te 2 .\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved 3 .\" Copyright (c) 2002-2006 Szabolcs Szakacsits 4 .\" Copyright (c) 2002-2005 Anton Altaparmakov 5 .\" Copyright (c) 2002-2003 Richard Russon 6 .\" Copyright (c) 2007 Yura Pakhuchiy 7 .\" This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 2 of the License, or (at your option) any later version. This program is distributed 8 .\" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program 9 .\" (in the main directory of the Linux-NTFS distribution in the file COPYING); if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 11-1307 USA 10 .TH NTFSRESIZE 1M "May 21, 2009" 11 .SH NAME 12 ntfsresize \- resize an NTFS file system without data loss 13 .SH SYNOPSIS 14 .LP 15 .nf 16 \fBntfsresize\fR [\fIoptions\fR] \fB--info\fR \fIdevice\fR 17 .fi 18 19 .LP 20 .nf 21 \fBntfsresize\fR [\fIoptions\fR] [\fB--size\fR \fIsize\fR[k|M|G]] \fIdevice\fR 22 .fi 23 24 .SH DESCRIPTION 25 .sp 26 .LP 27 The \fBntfsresize\fR program safely resizes Windows XP, Windows Server 2003, 28 Windows 2000, Windows NT4 and Longhorn NTFS filesystems without data loss. All 29 NTFS versions used by 32-bit and 64-bit Windows "operating systems" are 30 supported. Defragmentation is not required prior to resizing, because 31 \fBntfsresize\fR can relocate any data if needed, without risking data 32 integrity. 33 .sp 34 .LP 35 \fBntfsresize\fR can be used to shrink or enlarge any NTFS file system located 36 on an unmounted device (usually a disk partition). The new file system will 37 have a size that you specify. The size parameter can have one of the optional 38 modifiers \fBk\fR, \fBM\fR, \fBG\fR, denoting, respectively, kilobytes, 39 megabytes, or gigabytes. \fBntfsresize\fR conforms to the SI, ATA, an IEEE 40 standards and the disk manufacturers by supporting \fBk=10\fR^3, \fBM=10\fR^6 41 and \fBG=10\fR^9. 42 .sp 43 .LP 44 If both \fB---info\fR and \fB---size\fR options are omitted then the NTFS file 45 system will be enlarged to the underlying device size. 46 .sp 47 .LP 48 To resize a file system on a partition, you must resize both the file system 49 and the partition, by editing the partition table on the disk. Similarly to 50 other command-line file system resizers, \fBntfsresize\fR does not manipulate 51 the size of the partitions. To do that you must use a disk partitioning tool, 52 such as \fBfdisk\fR(1M). Alternatively, you could use one of the many user 53 friendly partitioners that uses \fBntfsresize\fR internally. Such partitioners 54 include, among others, Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST 55 Partitioner, IBM's EVMS, GParted, or Debian/Ubuntu's Partman. 56 .sp 57 .LP 58 Back up your data and your partition table before using any partitioning tool. 59 For an NTFS file system, you can use \fBntfsclone\fR(1M) as a means of backup. 60 .sp 61 .LP 62 To shrink an NTFS partition, first use \fBntfsresize\fR to shrink the size of 63 the file system. Then use a utility such as \fBfdisk\fR(1M) to shrink the size 64 of the partition by deleting the partition and recreating it with the smaller 65 size. Do not make the partition smaller than the new size of NTFS; otherwise, 66 you will not be able to boot from that partition. If you mistakenly made a 67 too-small partition, you would have to recreate the partition to be as large as 68 newly sized NTFS file system. 69 .sp 70 .LP 71 To enlarge an NTFS file system, you must first enlarge the size of the 72 underlying partition. You can use \fBfdisk\fR(1M) to delete the partition and 73 recreate it with a larger size. Make sure the newly sized partition does not 74 overlap with any other partition. Then use \fBntfsresize\fR to enlarge the file 75 system. 76 .sp 77 .LP 78 When recreating a partition, make sure you create it at the same starting 79 sector and with the same partition type as was used in the partition you are 80 replacing. Otherwise, you will not be able to access your file system. Use the 81 \fBfdisk u\fR command to switch from the default cylinder unit to the reliable 82 sector unit. Also, if the bootable flag was set in the old partition, make sure 83 to set it in the recreated partiton. Otherwise, you might not be able to boot 84 from the new partition. 85 .SH EXTENDED DESCRIPTION 86 .sp 87 .LP 88 There are a handful of very rarely met restrictions in the use of 89 \fBntfsresize\fR. An example of such a restriction occurs with a file system 90 stored on a disk having unknown bad sectors. Relocation of the first \fBMFT\fR 91 extent and resizing into the middle of a \fB$MFTMirr\fR extent are not 92 supported. These cases are detected and resizing is restricted to a safe size 93 or the closest safe size is displayed. 94 .sp 95 .LP 96 Upon completion of a resizing, \fBntfsresize\fR schedules an NTFS consistency 97 check. In Windows, this check is performed by \fBchkdsk\fR. Upon the first 98 subsequent reboot into Windows, you will note \fBchkdsk\fR running in a blue 99 background. This is normal. Windows might force a quick reboot after the 100 consistency check. Depending on your hardware configuration, Windows might 101 alert you to a systems setting change and recommend or require a reboot. 102 Acknowledge the message and reboot a second time. 103 .SH OPTIONS 104 .sp 105 .LP 106 Supported options are listed below. Most options have both single-letter and 107 full-name forms. Multiple single-letter options that do not take an argument 108 can be combined. For example, \fB-fv\fR is the equivalent of \fB-f\fR \fB-v\fR. 109 A full-name option can be abbreviated to a unique prefix of its name. 110 .sp 111 .ne 2 112 .na 113 \fB\fB-b\fR, \fB--bad-sectors\fR\fR 114 .ad 115 .sp .6 116 .RS 4n 117 By default, \fBntfsresize\fR exits upon encountering bad sectors. This option 118 allows the utility to proceed in spite of such sectors. 119 .sp 120 Prior using this option, it is strongly recommended that you use 121 \fBntfsclone\fR(1M) with the \fB--rescue\fR option to make a backup, then, in 122 Windows, run \fBchkdsk /f /r volume\fR: from the command line. If the disk 123 guarantee displays as valid, then replace it, as it is defective. Note that no 124 software can repair bad sector errors. The most that can be done is to work 125 around these defects. 126 .sp 127 This option has no effect if a disk has no bad sectors. 128 .RE 129 130 .sp 131 .ne 2 132 .na 133 \fB\fB-f\fR, \fB--force\fR\fR 134 .ad 135 .sp .6 136 .RS 4n 137 \fBntfsresize\fR always marks a file system for consistency check before a real 138 (not using \fB--no-action\fR) resize operation and it leaves that way for extra 139 safety. Thus, if an NTFS file system was marked by \fBntfsresize\fR, it is safe 140 to use this option. You must use this option, if you need to resize several 141 times without booting into Windows between each resizing step. 142 .RE 143 144 .sp 145 .ne 2 146 .na 147 \fB\fB-h\fR, \fB--help\fR\fR 148 .ad 149 .sp .6 150 .RS 4n 151 Display usage information and exit. 152 .RE 153 154 .sp 155 .ne 2 156 .na 157 \fB\fB-i\fR, \fB--info\fR\fR 158 .ad 159 .sp .6 160 .RS 4n 161 Used when you want to shrink a file system. Causes \fBntfsresize\fR to 162 determine the smallest shrunken file system size supported. Most of the time 163 the smallest size is the space already used on the file system. 164 \fBntfsresize\fR does not shrink a file system to a smaller size than what is 165 returned by this option. Depending on several factors, it might be unable to 166 shrink to this theoretical size. Although the integrity of your data should be 167 never at risk, it is nevertheless strongly recommended to make a test run by 168 using the \fB--no-action\fR option before actual resizing. 169 .sp 170 Based on testing, the smallest attainable size is approximately space used in 171 the file system plus 20-200 MB. Note also that Windows might need an additional 172 50-100 MB to boot safely. 173 .sp 174 This option never causes any changes to the file system; the partition is 175 opened read-only. 176 .RE 177 178 .sp 179 .ne 2 180 .na 181 \fB\fB-n\fR, \fB--no-action\fR\fR 182 .ad 183 .sp .6 184 .RS 4n 185 Use this option to make a test run before doing the resize operation. Volume 186 will be opened read-only and \fBntfsresize\fR displays what it would do if it 187 were to resize the file system. Proceed with the actual resizing only if the 188 test run passed. 189 .RE 190 191 .sp 192 .ne 2 193 .na 194 \fB\fB-P\fR, \fB--no-progress-bar\fR\fR 195 .ad 196 .sp .6 197 .RS 4n 198 Do not display progress bars during \fBntfsresize\fR operation. 199 .RE 200 201 .sp 202 .ne 2 203 .na 204 \fB\fB-s\fR, \fB--size\fR \fIsize\fR[k|M|G]]\fR 205 .ad 206 .sp .6 207 .RS 4n 208 Resize file system to \fIsize\fR bytes. The new file system will have a size 209 that you specify. The size parameter can have one of the optional modifiers 210 \fBk\fR, \fBM\fR, \fBG\fR, denoting, respectively, kilobytes, megabytes, or 211 gigabytes. \fBntfsresize\fR conforms to the SI, ATA, an IEEE standards and the 212 disk manufacturers by supporting \fBk=10\fR^3, \fBM=10\fR^6 and \fBG=10\fR^9. 213 Before performing an actual resizing, run \fBntfsresize\fR with the 214 \fB--no-action\fR option, along with this option, first. 215 .RE 216 217 .sp 218 .ne 2 219 .na 220 \fB\fB-v\fR, \fB--verbose\fR\fR 221 .ad 222 .sp .6 223 .RS 4n 224 Display copious output. 225 .RE 226 227 .sp 228 .ne 2 229 .na 230 \fB\fB-V\fR, \fB--version\fR\fR 231 .ad 232 .sp .6 233 .RS 4n 234 Display the version number of \fBntfsresize\fR. 235 .RE 236 237 .SH EXIT STATUS 238 .sp 239 .LP 240 Display zero on success, non-zero otherwise. 241 .SH ATTRIBUTES 242 .sp 243 .LP 244 See \fBattributes\fR(5) for descriptions of the following attributes: 245 .sp 246 247 .sp 248 .TS 249 box; 250 c | c 251 l | l . 252 ATTRIBUTE TYPE ATTRIBUTE VALUE 253 _ 254 Interface Stability Uncommitted 255 .TE 256 257 .SH SEE ALSO 258 .sp 259 .LP 260 \fBfdisk\fR(1M), \fBntfsclone\fR(1M), \fBparted\fR(1M), \fBattributes\fR(5) 261 .sp 262 .LP 263 http://wiki.linux-ntfs.org 264 .SH NOTES 265 .sp 266 .LP 267 In Linux version 2.6, with partitions that have been manipulated by 268 \fBparted\fR(1M), use of \fBntfsresize\fR preceded corruption of partition 269 tables, which resulted in unbootable Windows systems. This occurred even if the 270 NTFS file system was consistent. This problem is independent of NTFS and, thus, 271 \fBntfsresize\fR. Moreover, \fBntfsresize\fR never touches the partition table. 272 Under the conditions just described, you can, in the BIOS, change \fBDisk 273 Access Mode\fR to \fBLBA\fR to regain the ability to boot. For further 274 discussion of this condition see the \fBntfsresize\fR FAQ at: 275 \fBhttp://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html\fR. 276 .SH AUTHORS 277 .sp 278 .LP 279 \fBntfsresize\fR was written by Szabolcs Szakacsits, with contributions from 280 Anton Altaparmakov and Richard Russon.