Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • SSH into the CentOS OVA and sudo to root (unless you are already root)

    Code Block
    languagebash
    themeEmacs
    sudo su - 
    

List the block device to see the newly assigned vSphere hard disk.

Code Block
languagebash
themeEmacs
lsblk

Image Modified

If you do not see the vSphere hard disk, force a rescan

Code Block
languagebash
themeEmacs
for host in $(ls -1d /sys/class/scsi_host/*); do echo "- - -" > ${host}/scan ; done
for device in $(ls -1d /sys/class/scsi_disk/*); do echo "1" > ${device}/device/rescan ; done

create a new Partition that is compatible to LVM


  • Format the disk partition. Get the device name from the previous lsblk output

    Code Block
    languagebash
    themeEmacs
    fdisk /dev/sdb
    n (new partition)
    p (primary)
    (Press ENTER) (Use default partition number)
    (Press ENTER) (Use default first sector)
    (Press ENTER) (Use default last sector)
    
    t (change the partition type)
    8e (Linux LVM)
    
    w (write)
    

Create the Physical Volume for LVM

and check afterwards with pvs
Image Modified

Extend the Volumegroup (vg).

first check for the group with "vgs" then "vgextend centos" then check again:
Image Modified

now extend the Logival Volume (lv)

first check for the Volume with "vgs" then "lvextend" then check again:
Image Modified

resize filesystem

now in order to actually use the additional space we need to resize the filesystem.
first check the existing file system
Image Modified
then actually resize  the file system
Image Modified
and check again:
Image Modified

Voila!


In essence

  1. Increase Diskspace (physically or on the Hypervisor Layer)
  2. Reboot or rescan for disks
  3. create a new Partition that is compatible to LVM
  4. re-read Partition table either via reboot or command "partprobe"
  5. Initialise a new PV with pvcreate
  6. Increase  the VG with vgextend
  7. Increase  the LV with lvextend
  8. Increase the Filesystem with resize2fs

...