MAN page from Mandriva 2010 ext2resize-1.1.19-4mdv2010.0.i586.rpm
Section: Maintenance Commands (8)
Updated: July 2002Index
ext2resize - GNU ext2 filesystem resizer
tool resizes an unmounted ext2 or ext3 file system. It enlarges or shrinksthe file system located ondevice
(partition, loop device, logical volume, ...)so that it will havesize
ext2 filesystem blocks.If thesize
parameter is not specified, the filesystem will be resized to fill thegiven device.Thesize
parameter may have one of the optional modifiersb
which means thesize
parameter is given in 512-byte blocks, kilo-, mega-, giga-, orterabytes respectively.
Theext2resizeprogram does not manipulate the size of the device. If you wish toenlarge a filesystem, you must make sure you expand the underlyingdevice first. This can be done usingfdisk(8)for partitions, by deleting the partition and recreating it with alarger size (assuming there is free spaceafterthe partition in question). Make sure you re-create it with thesame starting disk cylinder as before! Otherwise, the resize operationwill certainly not work, and you may lose your entire filesystem.Logical Volumes can be extended withlvextend(8)prior to growing a filesystem, or after shrinking it. Alternately, thee2fsadm(8)tool can be used to combine the operations of resizing the Logical Volumeand the filesystem into one step.
If you wish to shrink an ext2 or ext3 partition, first useext2resizeto shrink the file system. You may then usefdisk(8)orlvreduce(8)to shrink the device. When shrinking the size of the device, make sureyou 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 filesystemslightly more than desired, shrink the device, and then runext2resizeagain to increase the filesystem to fill the new device size.
- -d, --debug
- Turns on various debugging messages, normally only useful if you areworking on a problem.
- -f, --force
- Force, do not perform sanity checks. Use with EXTREME care, you areon your own.
- -u, --unsafe
- Do not flush the device's buffer cache during the resize operation.
- -q, --quiet
- Do not print anything but error messages.
- -v, --verbose
- Turn on extra progress status messages.
- -V, --version
- Print the version number and exit.
- 1 Error in command line.
- 2 Error during resize operation.
The following example shows how to testext2resize
on a loop device. First a file of 10MB is created which is mounted onthe loop device. Then an 5MB ext2 filesystem is created on the loop device,after mounting its size is verified. Before extending unmounting isnecessary, when the size parameter is not specified the filesystem isextended to fill the loop device.
dd if=/dev/zero of=/tmp/file bs=1k count=10240
losetup /dev/loop0 /tmp/file
mke2fs /dev/loop0 5120
mount /dev/loop0 /mnt/test
mount /dev/loop0 /mnt/test
For shrinking the loop device we need to unmount it first, then runext2resizewith a size parameter, in this case 8MB.
ext2resize /dev/loop0 8M
Note that resizing a filesystem is inherently dangerous and may corruptfilesystems, although no errors resulting in data loss have ever beenreported to the author.Use with caution.
a good idea, because your disk may fail at any time, you delete files byaccident, or your computer is struck by a meteor.
was written by Lennert Buytenhek <buytenhAATTgnu.org> with the help ofvolunteers around the net. This man page was originally writtenby Joey Hess <joeyAATTkitenet.net>, and Dirk de Rycke significantlyimproved that version.
is (C) Copyright 1998, 1999 by Lennert Buytenhek, and 2000, 2001Andreas Dilger, and may be distributedunder the terms of the GNU General Public License.
- RETURN VALUES
- SEE ALSO
This document was created byman2html,using the manual pages.