Resize LVM Disk After Extending VMDK
Resize LVM Disk After Extending VMDK
https://access.redhat.com/solutions/202063
How to extend an LVM disk on a RHEL guest machine running on VMware host?
https://access.redhat.com/solutions/30374
2) Rescan the scsi bus on the guest so that it sees the new size.
To rescan execute the below step.
To determine the SCSI host ID from device names enter : ls -dl /sys/block/sd*/device/scsi_device/*
[root@infra-splunk ~]# ls -dl /sys/block/sd*/device/scsi_device/*
drwxr-xr-x. 3 root root 0 29 juil. 12:33 /sys/block/sda/device/scsi_device/2:0:0:0
drwxr-xr-x. 3 root root 0 29 juil. 12:33 /sys/block/sdb/device/scsi_device/2:0:2:0
fdisk -l /dev/sdc
4) determine if the entire disk is formatted as an LVM PV OR if the disk is formatted with partition table
(with several partitions)
IF the entire device is formatted as an LVM PV, resize the PV to claim the new, unallocated space.
pvresize /dev/sdc
ELSE IF the device is formatted with a partition table, and the partitions are used as LVM PVs (for example
/dev/sdc1), then you will need to create new partitions and create PVs on them :
a) Create a new partition using fdisk /dev/sda then save and quit.
If the following error occurs :
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
b) Check the device nodes for /dev/sda itself and the partitions on it
# ls /dev/sda*
c) Once a new partition has been created (for example sda3), create a new physical volume and add it to
the existing volume group:
# pvcreate /dev/sda3
# vgextend VolGroup00 /dev/sda3
If using Rhel 7, then the command differs, as Red Hat Enterprise Linux 7 uses xfs as the default filesystem
xfs_growfs /dev/VolGroup00/LogVol00
Resize LVM disk after extending Virtual Machine disk (vmdk)
https://www.howtovmlinux.com/articles/vmware/resize-lvm-disk-after-extending-virtual-machine-disk-
vmdk.html
Follow these simple steps to resize a Virtual machine disk (vmdk) and then extend the volume using LVM.
Make sure that you have/make a backup before carrying out these steps. First go ahead and extend the
vmdk from ESXi/vCenter. I increased the disk size from 20GB-->>30GB.
Before
After
Then Go ahead and run these commands to extend the LVM volume on Linux host.
# lsblk
# lsscsi -s
# ls /sys/class/scsi_disk/
Note: as it’s the 2nd disk = sdb, scan the 2nd entry
# pvdisplay
Take a note of the PE and use it to extend the FS and its associated Logical Volume.
I want to extend the « /var ». The associated LV can be determined with the following command :
# df -h | grep "/var"
OR
# resize2fs /dev/mapper/VolGroup01-var_lv
OR if FS type is xfs :
# xfs_growfs /dev/mapper/VolGroup01-var_lv
And that’s it. You should be up and running with the extra space with no downtime required or data loss as
it is LVM.