The database volume is an LVM device. You can resize it online by provided the underlying virtualization technology supports online disk expansion.
To expand the disk size:
- Login into the VCO system console.
- Identify the physical disks backing the database volume.
vgs -o +devices db_data
Example:
root@vco:~# vgs -o +devices db_data \ VG #PV #LV #SN Attr VSize VFree Devices db_data 1 1 0 wz--n- 500.00g 125.00g /dev/sdb(0)
- Identify the physical disk attachment.
lshw -class volume
Example:/dev/sdb is attached to scsi@2:0.1.0 (Host: scsi2 Channel: 00 Id: 01 Lun: 00)
root@vco:~# lshw -class volume *-volume description: EXT4 volume vendor: Linux physical id: 1 bus info: scsi@2:0.0.0,1 logical name: /dev/sda1 logical name: / version: 1.0 serial: 9d212247-77c4-4f98-a5c2-7f8470fa2da8 size: 10239MiB capacity: 10239MiB capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized configuration: created=2016-02-22 20:49:38 filesystem=ext4 label=cloudimg-rootfs lastmountpoint=/ modified=2016-02-22 21:18:58 mount.fstype=ext4 mount.options=rw,relatime,data=ordered mounted=2016-10-06 23:22:04 state=mounted *-disk:1 description: SCSI Disk physical id: 0.1.0 bus info: scsi@2:0.1.0 logical name: /dev/sdb serial: v5V2zm-Lvbh-Mfx3-W8ki-COI9-DAtP-RXndhu size: 500GiB capacity: 500GiB capabilities: lvm2 configuration: sectorsize=512 *-disk:2 description: SCSI Disk physical id: 0.2.0 bus info: scsi@2:0.2.0 logical name: /dev/sdc serial: fTQFJ2-giAV-WsXL-1Wha-V305-oQkV-qqS3SA size: 100GiB capacity: 100GiB capabilities: lvm2 configuration: sectorsize=512
- On the hypervisor host, locate the disk attached to the VM using bus info. Example:
SCSI(0:1)
- Extend the virtual disk. For instructions, see VMWare KB article 1004047: http://kb.vmware.com/kb/1004047
- Log back into the VCO system console.
- Re-scan the block device for the resized physical volume. Example:
echo 1 > /sys/block/$DEVICE/device/rescan
Example:
echo 1 > /sys/block/sdb/device/rescan
- Resize the LVM physical disk.
pvresize /dev/sdb
- Determine the amount of free space in the database volume group.
vgdisplay db_data |grep Free
Example:
root@vco:~# vgdisplay db_data |grep Free Free PE / Size 34560 / 135.00 GiB
- Extend the database logical volume.
lvextend -L+#G /dev/db_data/vco
Example:
root@vco:~# lvextend -L+10G /dev/db_data/vco Extending logical volume vco to 385.00 GiB Logical volume vco successfully resized
- Resize the database volume filesystem:
resize2fs /dev/db_data/vco
Example:
root@vco:~# resize2fs /dev/db_data/vco resize2fs 1.42.9 (4-Feb-2014) Filesystem at /dev/db_data/vco is mounted on /store; on-line resizing required old_desc_blocks = 24, new_desc_blocks = 25 The filesystem on /dev/db_data/vco is now 100924416 blocks long.
- See the new size of the volume.
df -h /dev/db_data/vco
Example:
root@vco:~# df -h /dev/db_data/vco Filesystem Size Used Avail Use% Mounted on /dev/mapper/db_data-vco 379G 1.2G 359G 1% /store