Howto resize Zevenet ADC filesystem with LVM

Overview

Zevenet Appliances are delivered in a lightweight format in order to make easy the deployment and installation in any platform, but if it’s required more storage for the logging system or custom application integration a filesystem resize is needed.
For that reason, the following document describes the procedure to increase the root filesystem size for a Zevenet virtual appliance. This procedure can be applied for appliances using LVM (Linux Volume Manager), please check if your root partition ( / ) can be increased with the following command:

root@zva#> lvdisplay  | grep "LV Path" | grep root
  LV Path                /dev/zva64/root

Note: If the LV Path doesn’t appear with the value /dev/zva64/root then your root partition can’t be increased.

Procedure

Attach to the virtual Load Balancer ZVA appliance a new virtual disk with the desired size. In this example we will increase the root partition ( / ) with 5 additional GBs. Note the size of / before to start (Only available 864Mb).

root@zva#> df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/dm-0                 1.9G  912M  864M  52% /

Now from the HyperVisor Client attach to the virtual load balancer a new virtual disk with 5GB.

resize fs virtual disk adc

In our example a new device will be detected inside the virtual load balancer with device name /dev/xvdb.

root@zva#> fdisk -l

Disk /dev/xvda: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x08115355

Device     Boot    Start      End  Sectors  Size Id Type
/dev/xvda1 *        2048   999423   997376  487M 83 Linux
/dev/xvda2        999424 13694975 12695552  6.1G 8e Linux LVM
/dev/xvda3      13694976 16775167  3080192  1.5G 82 Linux swap / Solaris

Disk /dev/mapper/zva64-root: 1.9 GiB, 2046820352 bytes, 3997696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/zva64-config: 488 MiB, 511705088 bytes, 999424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/zva64-log: 3.7 GiB, 3938451456 bytes, 7692288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/xvdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Now prepare the device /dev/xvdb to be included in LVM:

root@zva#> fdisk /dev/xvdb

And execute the following actions.

resize fs virtual disk adc with lvm

A new device with name /dev/xvdb1 has been created.

root@zva#> fdisk -l /dev/xvdb

Disk /dev/xvdb: 5 GiB, 5368709120 bytes, 10485760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa3e1a858

Device     Boot Start      End  Sectors Size Id Type
/dev/xvdb1       2048 10485759 10483712   5G 8e Linux LVM

Now include the new device already created /dev/xvdb1 in LVM.

root@zva#> pvcreate /dev/xvdb1
  Physical volume "/dev/xvdb1" successfully created

ZVA appliances only include one volume group called zva64, inside this volume group there are 3 logical volumes, one of them manages the root partition.

The following command shows the volume group size and name:

root@zva#> vgdisplay 
  --- Volume group ---
  VG Name               zva64
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               6.05 GiB
  PE Size               4.00 MiB
  Total PE              1549
  Alloc PE / Size       1549 / 6.05 GiB
  Free  PE / Size       0 / 0   
  VG UUID               EmgT1X-gPw3-f16M-kBC6-0x4s-LdS8-ymeyB6

Now include the device /dev/xvdb1 (5Gb) in the volume group with name zva64, automatically this volume group will be increased.

root@zva#> vgextend zva64 /dev/xvdb1
  Volume group "zva64" successfully extended

Note the total size after the latest command in the volume group:

root@zva#> vgdisplay 
  --- Volume group ---
  VG Name               zva64
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               11.05 GiB
  PE Size               4.00 MiB
  Total PE              2828
  Alloc PE / Size       1549 / 6.05 GiB
  Free  PE / Size       1279 / 5.00 GiB
  VG UUID               EmgT1X-gPw3-f16M-kBC6-0x4s-LdS8-ymeyB6

Now, the new free space should be added to partition root (/) in the logical volume with name root. Here the created logical volumes inside the volume group zva64.

root@zva#> lvdisplay 
  --- Logical volume ---
  LV Path                /dev/zva64/root
  LV Name                root
  VG Name                zva64
  LV UUID                EKZu18-rtrq-Fii5-3hCq-JIQh-OGG3-TQhbzU
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:25:23 -0400
  LV Status              available
  # open                 1
  LV Size                1.91 GiB
  Current LE             488
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/zva64/config
  LV Name                config
  VG Name                zva64
  LV UUID                tHSNAl-BAhc-4WeJ-7c24-23lW-91pD-xwATuq
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:26:39 -0400
  LV Status              available
  # open                 1
  LV Size                488.00 MiB
  Current LE             122
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
  --- Logical volume ---
  LV Path                /dev/zva64/log
  LV Name                log
  VG Name                zva64
  LV UUID                vjduEj-zLnx-tTEh-FJN6-SrOJ-iwdp-TGi3Sn
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:26:49 -0400
  LV Status              available
  # open                 1
  LV Size                3.67 GiB
  Current LE             939
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2

Extend the logical volume named root with the additional free space in the system (5 additional GB) as follows:

root@zva#> lvextend -l +100%FREE /dev/zva64/root
  Size of logical volume zva64/root changed from 1.91 GiB (488 extents) to 6.90 GiB (1767 extents).
  Logical volume root successfully resized

Note that now lvdisplay shows the new size in Logical Volume with name root.

root@zva#> lvdisplay 
  --- Logical volume ---
  LV Path                /dev/zva64/root
  LV Name                root
  VG Name                zva64
  LV UUID                EKZu18-rtrq-Fii5-3hCq-JIQh-OGG3-TQhbzU
  LV Write Access        read/write
  LV Creation host, time zva64ee40, 2015-07-28 09:25:23 -0400
  LV Status              available
  # open                 1
  LV Size                6.90 GiB
  Current LE             1767
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
  .
  .
  .

Finally resize the root filesystem ( / ) with the new available size:

root@zva#> resize2fs /dev/zva64/root
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/zva64/root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/zva64/root is now 1809408 (4k) blocks long.

Confirm the new free space with the following command (Available 5.6Gb):

root@zva#> df -h
Filesystem                Size  Used Avail Use% Mounted on
/dev/dm-0                 6.8G  914M  5.6G  14% /
udev                       10M     0   10M   0% /dev
tmpfs                      98M  4.4M   94M   5% /run
tmpfs                     245M     0  245M   0% /dev/shm
tmpfs                     5.0M     0  5.0M   0% /run/lock
tmpfs                     245M     0  245M   0% /sys/fs/cgroup
/dev/mapper/zva64-config  465M  2.3M  434M   1% /usr/local/zenloadbalancer/config
/dev/mapper/zva64-log     3.6G  7.6M  3.4G   1% /var/log
/dev/xvda1                464M   33M  403M   8% /boot

At this point, your load balancer is resized and ready to scale services.

Share on:

Was this article helpful?

Related Articles