| 1 |
.\" -*- nroff -*- |
| 2 |
.\" Copyright 1997 by Theodore Ts'o. All Rights Reserved. |
| 3 |
.\" |
| 4 |
.\" .TH RESIZE2FS 8 "March 2025" "E2fsprogs version 1.47.4" |
| 5 |
.TH RESIZE2FS 8 "March 2025" "E2fsprogs version 1.47.4" |
| 6 |
.SH NAME |
| 7 |
resize2fs \- ext2/ext3/ext4 file system resizer |
| 8 |
.SH SYNOPSIS |
| 9 |
.B resize2fs |
| 10 |
[ |
| 11 |
.B \-fFpPMbs |
| 12 |
] |
| 13 |
[ |
| 14 |
.B \-d |
| 15 |
.I debug-flags |
| 16 |
] |
| 17 |
[ |
| 18 |
.B \-S |
| 19 |
.I RAID-stride |
| 20 |
] |
| 21 |
[ |
| 22 |
.B \-z |
| 23 |
.I undo_file |
| 24 |
] |
| 25 |
.I device |
| 26 |
[ |
| 27 |
.I size |
| 28 |
] |
| 29 |
.SH DESCRIPTION |
| 30 |
The |
| 31 |
.B resize2fs |
| 32 |
program will resize ext2, ext3, or ext4 file systems. It can be used to |
| 33 |
enlarge or shrink an unmounted file system located on |
| 34 |
.IR device . |
| 35 |
If the file system is mounted, it can be used to expand the size of the |
| 36 |
mounted file system, assuming the kernel and the file system supports |
| 37 |
on-line resizing. (Modern Linux 2.6 kernels will support on-line resize |
| 38 |
for file systems mounted using ext3 and ext4; ext3 file systems will |
| 39 |
require the use of file systems with the resize_inode feature enabled.) |
| 40 |
.PP |
| 41 |
The |
| 42 |
.I size |
| 43 |
parameter specifies the requested new size of the file system. |
| 44 |
If no units are specified, the units of the |
| 45 |
.I size |
| 46 |
parameter shall be the file system blocksize of the file system. |
| 47 |
Optionally, the |
| 48 |
.I size |
| 49 |
parameter may be suffixed by one of the following units |
| 50 |
designators: 'K', 'M', 'G', 'T' (either upper-case or lower-case) or 's' |
| 51 |
for power-of-two kilobytes, megabytes, gigabytes, terabytes or 512 byte |
| 52 |
sectors respectively. The |
| 53 |
.I size |
| 54 |
of the file system may never be larger than the size of the partition. |
| 55 |
If |
| 56 |
.I size |
| 57 |
parameter is not specified, it will default to the size of the partition. |
| 58 |
.PP |
| 59 |
The |
| 60 |
.B resize2fs |
| 61 |
program does not manipulate the size of partitions. If you wish to enlarge |
| 62 |
a file system, you must make sure you can expand the size of the |
| 63 |
underlying partition first. This can be done using |
| 64 |
.BR fdisk (8) |
| 65 |
by deleting the partition and recreating it with a larger size or using |
| 66 |
.BR lvextend (8), |
| 67 |
if you're using the logical volume manager |
| 68 |
.BR lvm (8). |
| 69 |
When |
| 70 |
recreating the partition, make sure you create it with the same starting |
| 71 |
disk cylinder as before! Otherwise, the resize operation will |
| 72 |
certainly not work, and you may lose your entire file system. |
| 73 |
After running |
| 74 |
.BR fdisk (8), |
| 75 |
run resize2fs to resize the ext2 file system |
| 76 |
to use all of the space in the newly enlarged partition. |
| 77 |
.PP |
| 78 |
If you wish to shrink an ext2 partition, first use |
| 79 |
.B resize2fs |
| 80 |
to shrink the size of file system. Then you may use |
| 81 |
.BR fdisk (8) |
| 82 |
to shrink the size of the partition. When shrinking the size of |
| 83 |
the partition, make sure you do not make it smaller than the new size |
| 84 |
of the ext2 file system! |
| 85 |
.PP |
| 86 |
The |
| 87 |
.B \-b |
| 88 |
and |
| 89 |
.B \-s |
| 90 |
options enable and disable the 64bit feature, respectively. The resize2fs |
| 91 |
program will, of course, take care of resizing the block group descriptors |
| 92 |
and moving other data blocks out of the way, as needed. It is not possible |
| 93 |
to resize the file system concurrent with changing the 64bit status. |
| 94 |
.SH OPTIONS |
| 95 |
.TP |
| 96 |
.B \-b |
| 97 |
Turns on the 64bit feature, resizes the group descriptors as necessary, and |
| 98 |
moves other metadata out of the way. |
| 99 |
.TP |
| 100 |
.B \-d \fIdebug-flags |
| 101 |
Turns on various resize2fs debugging features, if they have been compiled |
| 102 |
into the binary. |
| 103 |
.I debug-flags |
| 104 |
should be computed by adding the numbers of the desired features |
| 105 |
from the following list: |
| 106 |
.br |
| 107 |
2 \-\ Debug block relocations |
| 108 |
.br |
| 109 |
4 \-\ Debug inode relocations |
| 110 |
.br |
| 111 |
8 \-\ Debug moving the inode table |
| 112 |
.br |
| 113 |
16 \-\ Print timing information |
| 114 |
.br |
| 115 |
32 \-\ Debug minimum file system size (\-M) calculation |
| 116 |
.TP |
| 117 |
.B \-f |
| 118 |
Forces resize2fs to proceed with the file system resize operation, overriding |
| 119 |
some safety checks which resize2fs normally enforces. |
| 120 |
.TP |
| 121 |
.B \-F |
| 122 |
Flush the file system device's buffer caches before beginning. Only |
| 123 |
really useful for doing |
| 124 |
.B resize2fs |
| 125 |
time trials. |
| 126 |
.TP |
| 127 |
.B \-M |
| 128 |
Shrink the file system to minimize its size as much as possible, |
| 129 |
given the files stored in the file system. |
| 130 |
.TP |
| 131 |
.B \-p |
| 132 |
Print out percentage completion bars for each |
| 133 |
.B resize2fs |
| 134 |
phase during an offline (non-trivial) resize operation, so that the user |
| 135 |
can keep track of what the program is doing. (For very fast resize |
| 136 |
operations, no progress bars may be displayed.) |
| 137 |
.TP |
| 138 |
.B \-P |
| 139 |
Print an estimate of the number of file system blocks in the file system |
| 140 |
if it is shrunk using |
| 141 |
.BR resize2fs 's |
| 142 |
.B \-M |
| 143 |
option and then exit. |
| 144 |
.TP |
| 145 |
.B \-s |
| 146 |
Turns off the 64bit feature and frees blocks that are no longer in use. |
| 147 |
.TP |
| 148 |
.B \-S \fIRAID-stride |
| 149 |
The |
| 150 |
.B resize2fs |
| 151 |
program will heuristically determine the RAID stride that was specified |
| 152 |
when the file system was created. This option allows the user to |
| 153 |
explicitly specify a RAID stride setting to be used by resize2fs instead. |
| 154 |
.TP |
| 155 |
.BI \-z " undo_file" |
| 156 |
Before overwriting a file system block, write the old contents of the block to |
| 157 |
an undo file. This undo file can be used with e2undo(8) to restore the old |
| 158 |
contents of the file system should something go wrong. If the empty string is |
| 159 |
passed as the undo_file argument, the undo file will be written to a file named |
| 160 |
resize2fs-\fIdevice\fR.e2undo in the directory specified via the |
| 161 |
\fIE2FSPROGS_UNDO_DIR\fR environment variable. |
| 162 |
|
| 163 |
WARNING: The undo file cannot be used to recover from a power or system crash. |
| 164 |
.SH KNOWN BUGS |
| 165 |
The minimum size of the file system as estimated by resize2fs may be |
| 166 |
incorrect, especially for file systems with 1k and 2k blocksizes. |
| 167 |
.SH AUTHOR |
| 168 |
.B resize2fs |
| 169 |
was written by Theodore Ts'o <[email protected]>. |
| 170 |
.SH COPYRIGHT |
| 171 |
Resize2fs is Copyright 1998 by Theodore Ts'o and PowerQuest, Inc. All |
| 172 |
rights reserved. |
| 173 |
As of April, 2000 |
| 174 |
.B Resize2fs |
| 175 |
may be redistributed under the terms of the GPL. |
| 176 |
.SH SEE ALSO |
| 177 |
.BR fdisk (8), |
| 178 |
.BR e2fsck (8), |
| 179 |
.BR mke2fs (8), |
| 180 |
.BR lvm (8), |
| 181 |
.BR lvextend (8) |