FacebookTwitterFlickrYoutuberss

Resize Root LVM Partition

From Zentyal Linux Small Business Server
Jump to: navigation, search
  • Title: Resize the root LVM partition
  • Author(s): Aryana Haribawa
  • Date: 7 Jul 2011
  • Version(s): 1.4, 2.0, 2.1, etc
  • Zentyal profiles: Base system

How to resize the root LVM partition of Zentyal Box safely

Zentyal is a powerful system useful for developing server for various purposes such as Domain Controller, Firewall, Router, E-mail, VPN, etc. And even better it is free!!!

However, Zentyal (specially in versions previous to 2.04 installer) has a serious problem with its default LVM partition configuration in which the root LVM Partition is set by default to be so small, hence at some point of time, especially if backup feature of the Zentyal Box is enabled, the system will run out of root system partition space, causing the Zentyal Box to crash.

The following steps on how to resize the root LVM partition of Zentyal Box has been tested and working perfectly so many times.

If your Zentyal Box has already crashed, boot it up. Although the Zentyal is not up yet but the Ubuntu OS is still up and running at the background. You can still connect to your Zentyal Box by doing the following steps 1 to 3.

If your Zentyal is still up and running okay at the moment, simply open the administrator console and then go straight to step 4 onward.

1) Download application putty.exe from internet

2) Install putty.exe in your Windows workstation

3) Connect to zentyal box using putty. Login as administrator or root (depends on your initial installation.

4) After logged in, at the administrator console run the following command at the console:

df -kh

5) You will be presented with the structure of hardisk capacity of your zentyal box.

6) Take note on the following structure of your Zentyal Box as example below:


Filesystem                          Size   Used   Avail   Use%   Mounted on
/dev/mapper/zentyal--svrname-root   2.3G   1.4G   727M    67%%   /
/dev/mapper/zentyal--svrname-home   5.2G   154M   4.8G    4%     /home


7) As you can see from the above example that your Zentyal Box is running out of root partition while on the other hand you have idle capacity at your home partition.

8) Need to reduce the size of the home partition and then use the freed capacity to add it to the root partition.

9) Next, download iso file of Linux System Rescue CD (systemrescuecd-x86-2.1.iso or newer version) from Internet, then burn the iso file into CD/DVD.

10) Boot your Zentyal Box with the Linux Rescue CD inside the CD/DVD Drive, choose option boot straight to graphical user interface.

11) From the command prompt run the following command:

e2fsck –f /dev/mapper/zentyal--svrname-home

12) Next we need to reduce the size of home partition to free some space. In this example we are reducing the home partition from 5.2G to 3G, so we have a free space of 2G. To do so, run the following command:

resize2fs /dev/mapper/zentyal--svrname-home 3G
lvresize –L3G /dev/mapper/zentyal--svrname-home
lvdisplay /dev/mapper/zentyal--svrname-home

You will see that your LV size of your home partition is now set to 3GB. After that reboot the Zentyal Box using command:

reboot


13) After the Zentyal Box boots up, connect the Zentyal Box again using putty. Login with administrator or root access if your server was crashed at the beginning of this resizing effort. If your Zentyal Box was still running okay at the beginning of the resizing effort, simply open the administrator console.

14) Next we need to increase the root partition. In this example we are adding the 2 GB free space we get from the reduction of home partition into the root partition, hence the final capacity of root partition will be 2.3G + 2G = 4.3G. In this case we round it down to 4G. To do so, run the following command:


lvresize –L4G /dev/mapper/zentyal--svrname-root
resize2fs /dev/mapper/zentyal--svrname-root 4G
lvdisplay /dev/mapper/zentyal--svrname-root

You will see that your LV size of your root partition is now set to 4GB. After that reboot the Zentyal Box using command:

reboot


15) Voila!! Your Zentyal Box now has bigger capacity in its root partition so that it will never crash again. Re-check again your new configuration by re-running df –kh command again from the administrator console.

Personal tools
Namespaces

Variants
Actions

Zentyal Wiki

Zentyal Doc
Navigation
Toolbox