
▶ BLOG
KB No. 2359: ADDING A DISK TO VMWARE APPLIANCES
How to add an additional disk to VMware virtual appliances.
Objective
Add an additional disk to VMware virtual appliances.
BACKGROUND
Partitions on Olfeo VMware appliances are based on LVM. The purpose of this tutorial is to increase the available disk space.
Here is a diagram showing the architecture at the deployment of virtual appliances, then at the end of this tutorial:

STEPS
It is recommended that you create a snapshot of the virtual machine before performing the following operations.
- First, you need to create a new disk from the VMware interface, then add this new disk to the Olfeo appliance.
- Then log in to the appliance in console mode, and do the following: fdisk /dev/sdb where sdb is the name of the new disk. This name may vary depending on the configuration. Once launched fdiskPress the following keys: (n)ew partition, (p)rimary, (1)st partition, (Default), (Default), (w)rite:

- Shut down the Olfeo chroot part: /etc/init.d/olfeo-chroot stop
- Move the files located in thedata folder: mkdir /root/data_temp && mv /opt/olfeo5/chroot/opt/olfeo5/data/* /root/data_temp
- Create the new physical volume so that LVM can use this partition: pvcreate /dev/sdb1
- Add this physical volume to thevaolfeo volume group: vgextend vaolfeo /dev/sdb1
- Create the new logical volume: (Replace the value "10G" with that of the disk set up in VMware) lvcreate -n data -L 10G vaolfeo
- Format this new logical volume in ext4: mkfs -t ext4 /dev/vaolfeo/data
- Add the following line to/etc/fstabso that the new logical volume is used by thedata folder:/dev/mapper/vaolfeo-data /opt/olfeo5/chroot/opt/olfeo5/data ext4 defaults 0 1
- Apply the changes to the mount points: mount -a
Validation
Verify that thedatafolder is using the new logical volume:

Once this has been verified:
- Move thedatafolder back to its original location: mv /root/data_temp/* /opt/olfeo5/chroot/opt/olfeo5/data
- Restart the chroot part: /etc/init.d/olfeo-chroot start
Additions to increase the partition size later:
To increase the size of this volume again, repeat steps 1, 2, 5, and 6 above, then perform the following steps:
- Unmount thedatapartition so that you can perform the necessary operations: umount /opt/olfeo5/chroot/opt/olfeo5/data
- Perform a check of the file system to be modified: e2fsck -f /dev/vaolfeo/data
- Resize the logical volume: (replace 20g with the total size you want) Be careful not to reduce the size of the disk at this point, or you may lose data. lvresize -L 20g /dev/vaolfeo/data
- Resize the partition: resize2fs /dev/vaolfeo/data
- Mount the partition: mount -a
At this stage, a 20GBdatapartition uses the second installed disk:
