Ext3 Hot-resizing

From Linux Raid Wiki
Jump to: navigation, search

Ext3 Hot-resizing

What this means is the ability to change the size of an ext3 file system while it is in use.

Ext3 only supports resizing if you are making the file system bigger

How to Hot-resize and make the file system bigger

First make the partition bigger and then run resize2fs. You do not need to tell resize2fs how big the partition is because it will work that out for itself.

The commands to do this are something like this:

 lvextend --size +50G /dev/vgmintsingle/ARCH
 resize2fs /dev/mapper/vgmintsingle-ARCH

How to make the file system smaller

This is more complicated mainly due to having to work out the size that the file system will be and then shrinking the LVM to match. This is very hard to get exactly right and not loose/waste some space. The easiest way is to resize the file system by more than needed, resize the LVM partition and then resize the file system to fill the LVM partition:

 umount /dev/mapper/vgmintsingle-ARCH
 resize2fs /dev/mapper/vgmintsingle-ARCH 29G
 lvextend --size 30G /dev/vgmintsingle/ARCH
 resize2fs /dev/mapper/vgmintsingle-ARCH
 mount /dev/mapper/vgmintsingle-ARCH
Personal tools