05 Add Extra Disk Space


Overview

During 04 Install OMS 12.1.0.3.1 , I found that CRONULLA had 5GB less disk space than expected. I use the Logical Volume Manager to add extra disk space after I update the VirtualBox settings to include an extra disk drive.

References

Procedure

Shut Down CRONULLA

Shut down the CRONULLA so that I can add an extra disk drive.

Add an Extra Disk Drive

I decided to add an extra disk drive of size 20GB to CRONULLA VM.

Controller SATA
Create new disk
Hard drive file type VDI (VirtualBox Disk Image)
Storage on physical hard drive Fixed size
File name CRONULLA_oms.vdi
Storage on physical hard drive 20GB

Start Up CRONULLA

Start up the CRONULLA so that I can format the extra disk drive.

Add Extra Space

Create New Physical Volume

Following the procedure in 16.3.1 Initializing and Managing Physical Volumes , the new disk drive, /dev/sdb , by using the pvcreate command:

[root@cronulla ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created

Add New Physical Disk to Volume Group

First, I discover the current volume group names through the vgdisplay command:

[root@cronulla ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_cronulla
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               29.51 GiB
  PE Size               4.00 MiB
  Total PE              7554
  Alloc PE / Size       7554 / 29.51 GiB
  Free  PE / Size       0 / 0
  VG UUID               0z9I6F-KqWK-NX7m-V6HE-brRQ-mkH8-gL1kpC

Using the discovered name of vg_cronulla , I followed the procedure in 16.3.2 Creating and Managing Volume Groups in order to extend the volume group to include the new physical volume on /dev/sdb through the use of the vgextend command:

[root@cronulla ~]# vgextend vg_cronulla /dev/sdb
  Volume group "vg_cronulla" successfully extended

Increase the Size of the Logical Volume

16.3.3 Creating and Managing Logical Volumes suggested the use of the lvresize command.

I used the lvdisplay command to discover the name of the logical volume that needed to be extended:

[root@cronulla ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg_cronulla/lv_root
  LV Name                lv_root
  VG Name                vg_cronulla
  LV UUID                HbxPah-4LhC-NPfB-MRO5-8NpQ-vIiE-caZh2D
  LV Write Access        read/write
  LV Creation host, time cronulla.yaocm.id.au, 2014-03-02 18:02:33 +1100
  LV Status              available
  # open                 1
  LV Size                26.51 GiB
  Current LE             6786
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/vg_cronulla/lv_swap
  LV Name                lv_swap
  VG Name                vg_cronulla
  LV UUID                0EnfzH-7aK1-zbPH-UYyS-C9Ks-mxej-WPGSPv
  LV Write Access        read/write
  LV Creation host, time cronulla.yaocm.id.au, 2014-03-02 18:02:36 +1100
  LV Status              available
  # open                 2
  LV Size                3.00 GiB
  Current LE             768
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

I then used the lvresize command to extend vg_cronulla/lv_root by 10 GB:

[root@cronulla ~]# lvresize --size +10G vg_cronulla/lv_root
  Extending logical volume lv_root to 36.51 GiB
  Logical volume lv_root successfully resized

Increase the File System Size

I used the fsadm command to increase the root filesystem to use all of the newly available space on its logical volume:

[root@cronulla ~]# fsadm resize /dev/mapper/vg_cronulla-lv_root
resize2fs 1.43-WIP (20-Jun-2013)
Filesystem at /dev/mapper/vg_cronulla-lv_root is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 3
The filesystem on /dev/mapper/vg_cronulla-lv_root is now 9570304 blocks long.

I confirmed the new size of the filesystem through the df command:

[root@cronulla ~]# df -lh
Filesystem                       Size  Used Avail Use% Mounted on
/dev/mapper/vg_cronulla-lv_root   36G   15G   20G  44% /
tmpfs                            3.0G     0  3.0G   0% /dev/shm
/dev/sda1                        477M   55M  398M  13% /boot