1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
.\" -*- nroff -*-
.\"
.\" The initial version of this man page was written by Joey Hess
.\" <joey@kitenet.net>, slightly tweaked by Lennert Buytenhek.
.\" Dirk de Rycke significantly improved that version and after
.\" Lennert Buytenhek had yet again tweaked it a little it became
.\" the man page you are reading now.
.TH EXT2RESIZE 8 "March 2001" "ext2resize v1.1.17"
.SH NAME
ext2resize \- GNU ext2 filesystem resizer
.SH SYNOPSIS
.BR ext2resize " [" -d "] [" -f "] ["
.BR -q "] [" -u "] [" -v "] [" -V ]
.IR device " [" size [\fBb\fR|\fBK\fR|\fBM\fR|\fBG\fR|\fBT\fR]]
.SH "DESCRIPTION"
The
.B ext2resize
tool resizes an unmounted ext2 file system. It enlarges or shrinks an
ext2 file system located on a
.I device
(partition, loop device, logical volume, ...)
so that it will have
.I size
ext2 filesystem blocks.
If the
.I size
parameter is not specified, the filesystem will be resized to fill the
given device.
The
.I size
parameter may have one of the optional modifiers
.BR b ,
.BR K ,
.BR M ,
.BR G ,
or
.B T
which means the
.I size
parameter is given in 512\-byte blocks, kilo\-, mega\-, giga\-, or
terabytes respectively.
.PP
The
.B ext2resize
program does not manipulate the size of the device. If you wish to
enlarge a filesystem, you must make sure you expand the underlying
device first. This can be done using
.BR fdisk (8)
for partitions, by deleting the partition and recreating it with a
larger size (assuming there is free space
.I after
the partition in question). Make sure you re\-create it with the
same starting disk cylinder as before! Otherwise, the resize operation
will certainly not work, and you may lose your entire filesystem.
Logical Volumes can be extended with
.BR lvextend (8)
prior to growing a filesystem, or after shrinking it. Alternately, the
.BR e2fsadm (8)
tool can be used to combine the operations of resizing the Logical Volume
and the filesystem into one step.
.PP
If you wish to shrink an ext2 partition, first use
.B ext2resize
to shrink the file system. You may then use
.BR fdisk (8)
or
.BR lvreduce (8)
to shrink the device. When shrinking the size of the device, make sure
you do not make it smaller than the reduced size of the ext2 filesystem.
If you are not sure of the exact device size, shrink the filesystem
slightly more than desired, shrink the device, and then run
.B ext2resize
again to increase the filesystem to fill the new device size.
.TP
.BR \-d ", " \-\-debug
Turns on various debugging messages, normally only useful if you are
working on a problem.
.TP
.BR \-f ", " \-\-force
Force, do not perform sanity checks. Use with EXTREME care, you are
on your own.
.TP
.BR \-u ", " \-\-unsafe
Do not flush the device's buffer cache during the resize operation.
.TP
.BR \-q ", " \-\-quiet
Do not print anything but error messages.
.TP
.BR \-v ", " \-\-verbose
Turn on extra progress status messages.
.TP
.BR \-V ", " \-\-version
Print the version number and exit.
.SH RETURN VALUES
0 Resizing successful.
.TP
1 Error in command line.
.TP
2 Error during resize operation.
.SH EXAMPLES
The following example shows how to test
.B ext2resize
on a loop device. First a file of 10MB is created which is mounted on
the loop device. Then an 5MB ext2 filesystem is created on the loop device,
after mounting its size is verified. Before extending unmounting is
necessary, when the size parameter is not specified the filesystem is
extended to fill the loop device.
.PP
\ dd if=/dev/zero of=/tmp/file bs=1k count=10240
.br
\ losetup /dev/loop0 /tmp/file
.br
\ mke2fs /dev/loop0 5120
.br
\ mkdir /mnt/test
.br
\ mount /dev/loop0 /mnt/test
.br
\ df /mnt/test
.br
\ umount /mnt/test
.br
\ ext2resize /dev/loop0
.br
\ mount /dev/loop0 /mnt/test
.br
\ df /mnt/test
.PP
For shrinking the loop device we need to unmount it first, then run
.B ext2resize
with a size parameter, in this case 8MB.
.PP
\ umount /mnt/test
.br
\ ext2resize /dev/loop0 8M
.br
\ mount /mnt/test
.br
\ df /mnt/test
.SH WARNING
Note that resizing a filesystem is inherently dangerous and may corrupt
filesystems, although no errors resulting in data loss have ever been
reported to the author.
.B Use with caution.
Backups are
.B always
a good idea, because your disk may fail at any time, you delete files by
accident, or your computer is struck by a meteor.
.SH AUTHOR
.B GNU ext2resize
was written by Lennert Buytenhek <buytenh@gnu.org> with the help of
volunteers around the net. This man page was originally written
by Joey Hess <joey@kitenet.net>, and Dirk de Rycke significantly
improved that version.
.SH COPYRIGHT
.B GNU ext2resize
is (C) Copyright 1998, 1999 by Lennert Buytenhek, and 2000, 2001
Andreas Dilger, and may be distributed
under the terms of the GNU General Public License.
.SH SEE ALSO
.BR fdisk (8)
.BR e2fsck (8)
.BR e2fsadm (8)
.BR mke2fs (8)
.BR losetup (8)
.BR lvextend (8)
.BR lvreduce (8)
|