(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

5. Growing your filesystem

You can do this with a provided script which does a lot of work for you, or you can do it by hand if needed.

5.1 With e2fsadm

If there is room within your volume group, and you use the ext2 filesystem (most people do), you can use this handy tool.

The e2fsadm command uses the commercial resize2fs tool. While people feel that this is good software, it is not very widely installed.

If you want to use the FSF's ext2resize command, you need to inform e2fsadm of this:

 
# export E2FSADM_RESIZE_CMD=ext2resize 
# export E2FSADM_RESIZE_OPTS=""

The rest is easy, e2fsadm is a lot like the other LVM commands:

# e2fsadm /dev/test/HOWTO -L+50M
e2fsadm -- correcting size 102 MB to physical extent boundary 104 MB
e2fsck 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/test/HOWTO: 11/25688 files (0.0% non-contiguous), 3263/102400 blocks
lvextend -- extending logical volume "/dev/test/howto" to 104 MB
lvextend -- doing automatic backup of volume group "test"
lvextend -- logical volume "/dev/test/HOWTO" successfully extended

ext2_resize_fs
ext2_grow_fs
ext2_block_relocate
ext2_block_relocate_grow
ext2_grow_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
ext2_add_group
direct hits 4096 indirect hits 0 misses 1
e2fsadm -- ext2fs in logical volume "/dev/test/HOWTO" successfully extended to 104 MB

5.2 Growing your Logical Volume

The e2fsadm command takes care of this for you. However, it may be useful to understand how to do this manually:

If you have room within your Volume Group, this is a one liner:

# lvextend -L+12M /dev/test/HOWTO 
lvextend -- rounding size to physical extent boundary
lvextend -- extending logical volume "/dev/test/HOWTO" to 116 MB
lvextend -- doing automatic backup of volume group "test"
lvextend -- logical volume "/dev/test/HOWTO" successfully extended

5.3 Growing your Volume Group

This is done with the vgextend utility, and is easy as pie. You first need to create a physical volume. This is done with the pvcreate utility. With this tool, you convert any block device into a physical volume.

After that is done, vgextend does the rest:

# pvcreate /dev/sda1
pvcreate -- physical volume "/dev/sda1" successfully created
# vgextend webgroup /dev/sda1
vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte
vgextend -- doing automatic backup of volume group "webgroup"
vgextend -- volume group "webgroup" successfully extended

Please note that in order to do this, your Volume Group needs to be active. You can make it by executing 'vgchange -a y webgroup'.

5.4 Growing your filesystem

If you want to do this manually, there are a couple of ways to do this.

ext2 off-line with ext2resize

By off-line, we mean that you have to unmount the file-system to make these changes. The file-system and it's data will be unavailable while doing this. Note this means you must use other boot media if extending the size of the root or other important partitions.

The ext2resize tool is available on the GNU ftp size, but most distributions carry it as a package. The syntax is very straightforward:

# ext2resize /dev/HOWTO/small 40000
Where 40000 is the number of blocks the filesystem should have after growing or shrinking.

ext2 on-line

FIXME: write this


Next Previous Contents