Version 2 (modified by SamK, 4 years ago) (diff)

--

Live Storage Space Resize

When you originally installed the system, the amount of disk space used was appropriate for your requirements at that time. Since then, those requirements have changed; the number of system files, or data files have grown to the point where the amount of storage space has to be increased.

By following the recommended way of installing eBox, you allocated the storage space using LVM to create logical volumes inside a volume group. One of the benfits of this is that you can now dynamically resize any or of all storage spaces within the group. The following examples show you how to resize those volumes without server downtime or interrupting the service to your users.

Growing the root Logical Volume and ext3 File System by 1.0GB

Verify the current size of the volume (in this example 4.0GB):

% df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ebox-root   
                   4.0G  749M  3.1G  20% /

Verify that the volume group contains sufficient free space to extend the root logical volume (see VFree column):

% vgdisplay -C
  VG   #PV #LV #SN Attr   VSize  VFree
  ebox   1   3   0 wz--n- 19.75G 11.25G

Extend the logical volume root in the volume group ebox by 1.0GB :

% lvextend -L+1G /dev/ebox/root
  Extending logical volume root to 5.00 GB
  Logical volume root successfully resized

Extend the ext3 file system in the logical volume root:

% resize2fs /dev/ebox/root
resize2fs 1.40.8 (13-Mar-2008)
Filesystem at /dev/ebox/root is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/ebox/root to 1310720 (4k) blocks.
The filesystem on /dev/ebox/root is now 1310720 blocks long.

Verify the new size:

% df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ebox-root
                      5.0G  749M  4.0G  16% /

Resizing the var partition (or any other XFS file system)

We have a var partition of 4G for example:

% df -h /var/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ebox-var  4.0G  175M  3.9G   5% /var

Check that we have enough free space in the volume group to extend the var logical volume (see VFree column):

% vgdisplay -C
  VG   #PV #LV #SN Attr   VSize  VFree
  ebox   1   3   0 wz--n- 19.75G 10.25G

Extend the logical volume var on ebox volume group:

% lvextend -L+1G /dev/ebox/var
  Extending logical volume var to 5.00 GB
  Logical volume var successfully resized

Extend the XFS file system:

% xfs_growfs /dev/ebox/var
meta-data=/dev/mapper/ebox-var   isize=256    agcount=8, agsize=131072 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=1048576, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal               bsize=4096   blocks=2560, version=1
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1048576 to 1310720

Check the new size:

% df -h /var
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/ebox-var  5.0G  175M  4.9G   4% /var