Info | ||
---|---|---|
| ||
Client takes on full responsibility for the execution of this task. This should not be attempted unless you are qualified. |
This being said, there are a number of huge advantages to extend your Diskspace via LVM over other means (e.G. you do not have to split up your storage over several logical mountpoints) and this has proven to be reliable, scalable and fast.
Should you have the need for increasing your Diskspace and are not feeling comfortable with this procedure, please feel free to contact Patrix, Serviva or Pace-Ip for assistance.
Add Harddisk Space in your Hypervisor Environment
...
Make Disk visible to the OVA
- Prior to proceeding, you must identify the current LVM configuration and number of existing primary partitions.
- If you already have 4 primary partitions (sda1, sda2, sda3, sda4), you will need to add the additional space as a new disk (sdb X).
- If you don't have 4 primary partitions, you may add a new partition to the existing.
SSH into the CentOS OVA and sudo to root (unless you are already root)
Code Block language bash theme Emacs sudo su -i
List the block device to see the newly assigned vSphere hard disk.
Code Block | ||||
---|---|---|---|---|
| ||||
lsblk
|
If you do not see the vSphere hard disk, force a rescan (or reboot which is less elegant but just as effective)
Code Block | ||||
---|---|---|---|---|
| ||||
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 language bash theme Emacs 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)
in order to see this partition, read the partition table with "partprobe" (or reboot which is less elegant but just as effective)
- If an GPT ERROR appears at the end of the fdisk dialogue or after using partprobe: "Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?", do the following command wirth parted:
Create the Physical Volume for LVM
and check afterwards with pvs
Extend the Volumegroup (vg).
first check for the group with "vgs" then "vgextend centos" then check again:
now extend the Logical Volume (lv)
first check for the Volume with "lvs" then "lvextend" then check again:
resize filesystem
now in order to actually use the additional space we need to resize the filesystem.
first check the existing file system
then actually resize the file system - for newer systems it's recommended to use "xfs_growfs /dev/mapper/centos-root".
Otherwise, use:
and check again:
Voila!
In essence
- Increase Diskspace (physically or on the Hypervisor Layer)
- Reboot or rescan for disks
- create a new Partition that is compatible to LVM
- re-read Partition table either via reboot or command "partprobe"
- Initialise a new PV with
pvcreate
- Increase the VG with
vgextend
- Increase the LV with
lvextend
- Increase the Filesystem with
resize2fs
In case of an extension of an existing partition:
Following above example, if sda would have received an additional 200GB instead of integrating a different (sdb) partition.
- Increase Diskspace (physically or on the Hypervisor Layer)
- Reboot or rescan for disks
- Use lsblk to identify which partition got increased
- identify the free space in the partition
- parted /dev/sda print free
- Increase the last partition, if it fits the filesystem. Use:
- parted /dev/sda
- resizepart
- insert which partition should be resized/increased, in the above case, it would be "3" for sda3.
- insert new volume End, as seen via step 4a, where the End of the Free space, should be the new End for partition 3.
- pvresize /dev/sda3 or resizefs /dev/sda3
- Increase the LV as seen above
- resize filesystem