File: ext2prepare.8

package info (click to toggle)
ext2resize 1.1.17-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 772 kB
  • ctags: 678
  • sloc: ansic: 4,595; sh: 389; makefile: 56
file content (200 lines) | stat: -rw-r--r-- 6,041 bytes parent folder | download
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.\" -*- nroff -*-
.\" Written by Andreas Dilger based on the ext2resize.8 man page.
.TH EXT2PREPARE 8 "March 2001" "ext2prepare v1.1.17"
.SH NAME
ext2prepare \- ext2 filesystem resizing preparation tool
.SH SYNOPSIS
.BR ext2prepare " [" \-d "] [" -f "] [" -q "] [" -v "] [" -V ]
.IR "device size" [\fBb\fR|\fBK\fR|\fBM\fR|\fBG\fR|\fBT\fR]]
.SH "DESCRIPTION"
The
.B ext2prepare
command modifies an unmounted ext2 filesystem on
.I device
so that
.BR ext2online (8)
program can later resize the mounted filesystem to be at least as large as
.I size
although the actual maximum size will be some larger multiple of various
filesystem parameters.  While
.B ext2prepare
must be run on an unmounted filesystem,
.I device
does not have to currently be as large as
.IR size .
This allows one to later increase the size of
.I device
and do the resize while the filesystem is mounted.
.PP
If the
.I size
parameter does not have a modifier, it will be taken to be in ext2
filesystem blocks (which can be 1k, 2k, or 4k \-  use
.BR dumpe2fs (8)
to find out more information about the current filesystem).  The modifiers
.BR b ,
.BR K ,
.BR M ,
.BR G ,
or
.B T
mean the
.I size
parameter is given in 512\-byte blocks, kilo\-, mega\-, giga\-, or terabytes
respectively.

.PP
The
.B ext2prepare
program does not change the size of the actual device.  If you wish to
enlarge a filesystem, you must make sure you expand the underlying device
first.  This can be done online for Logical Volumes by using
.BR lvextend (8)
from the LVM package, or possibly via
.B md
or
.B RAID
facilities in the hardware if you are not using partitions.  It is
.B not
possible to do this by using the
.BR fdisk (8)
family of tools to extend a partition while it is mounted (at least the
author has not been able to successfully do this).

.PP
Because of the original design of the ext2 filesystem did not have
online resizing in mind, there are certain limitations to the amount of
resizing that can be done while the filesystem is mounted, if you
haven't done any preparation for the resize.  The default block size for
ext2 was 1k blocks until v1.15 of e2fsprogs (1999), where it changed to
4k blocks for filesystems larger than 500MB.

.PP
With no filesystem preparation, it is always possible to resize to the
next 256MB boundary for 1k filesystems, the next 2GB boundary for for 2k
filesystems, and the next 16GB boundary for 4k filesystems.  By using
.B ext2prepare
on an unmounted filesystem, it is possible for
.BR ext2online (8)
to increase the size of a mounted ext2 filesystem to at least the given
.I size
by reserving blocks for group descriptors within the ext2 filesystem
structure.
.B ext2prepare
does this by moving metadata blocks while the filesystem is unmounted,
and then allocating the freed blocks to a reserved inode so that
.BR ext2online (8)
can later use these blocks to safely enlarge the filesystem while the
filesystem is in use.
.PP
.SH OPTIONS
.TP
.BR \-d ", " \-\-debug
Turn on debugging messages.
.TP
.BR \-f ", " \-\-force
Force preparation without first checking the filesystem state.
.TP
.BR \-q ", " \-\-quiet
Do not print anything but error messages.
.TP
.BR \-v ", " \-\-verbose
Turn on normal verbose status messages.
.TP
.BR \-V ", " \-\-version
Print the version number and exit.

.SH RETURN VALUES
0	Resizing successful
.TP
1	Error in options or command-line parameters.
.TP
2	Error while preparing filesystem.

.SH EXAMPLES
The following example shows how to test
.B ext2prepare
with a spare partition.  First a filesystem of 32MB is created on the
device.  The filesystem is then prepared to grow to a maximum size of 10GB,
mounted, and the size is verified.  The filesystem is then extended to
fill the device (the default action when no size is given), and the new
size is verified.

.PP
\	mke2fs /dev/vg0/lvtest 32768
.br
\	ext2prepare /dev/vg0/lvtest 10G
.br
\	mkdir /mnt/test
.br
\	mount \-o debug,check=strict /dev/vg0/lvtest /mnt/test
.br
\	df /mnt/test
.br
\	ext2online -d -v /dev/vg0/lvtest
.br
\	df /mnt/test

.PP
By using the
.I debug
and
.I "check=strict"
options to mount, as well as the
.B \-d
and
.B \-v
options to
.BR ext2prepare ,
we will see the user-space status messages, and the kernel
messages will be logged by syslog.

.SH WARNING
Note that resizing a mounted filesystem is inherently dangerous and may
corrupt filesystems, although no errors resulting in data loss have ever
been reported to the author.  In theory online resizing should work fine
with arbitrarily large filesystems, but it has not yet been tested by the
author on a filesystem larger than 11GB.
.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
The 
.B ext2prepare
program was written by Andreas Dilger <adilger@turbolinux.com> using
the ext2 resizing tools developed by Lennert Buytenhek <buytenh@gnu.org>.
The ext2online kernel patches are available as part of the GNU ext2resize
package at <http://sourceforge.org/projects/ext2resize/>.

.SH BUGS
Because
.B ext2prepare
uses a reserved inode to store blocks needed for a future resize
(so that they can't be accidentally used by another program),
.BR e2fsck (8)
needs to be slightly modified to understand this new reserved inode.
If an unmodified
.BR e2fsck (8)
is run on a filesystem that has been changed with
.BR ext2prepare ,
it will complain about the reserved inode and free all of the blocks
associated with this inode.  If this happens, it will not be possible
to resize the filesystem past the default limits given previously.
However, the filesystem itself is not affected in any way by these events.
The ext2resize programs do
.B not
work on big\-endian machines (Alpha, SPARC, PPC, etc).

.SH COPYRIGHT
.B ext2prepare
is (C) Copyright 1999, 2000, 2001 by Andreas Dilger and may be
distributed under the terms of the GNU General Public License.
.SH "SEE ALSO"
.BR dumpe2fs (8)
.BR ext2online (8)
.BR ext2resize (8)
.BR e2fsck (8)
.BR lvextend (8)