how to extend LVM disk size after adding new HOTadd disk in ESX VM

Here's quick how-to to add a 40GB VMDK to RHEL/CentOS LVM under ESXi. The same procedures can also be done to physical server environments as well.

1. After you assigned a new disk to the virtual machine you have to add it in the guest and expand the LVM volume.
First rescan the SCSI bus to make the kernel detect the new virtual disk:

# echo "- - -" > /sys/class/scsi_host/host0/scan
 
Find out what the new device is called, should be displayed with 'dmesg'. If it is too noisy, you may get what you need with

# dmesg | grep sd[abcde]
  
Similarly type
 
#fdisk -l 

2. # pvscan
      This will show you the current physical volumes.

3. # fdisk /dev/sdb
      Add the disk to your machine as a primary partition. Partition type: “8e (LVM)”.

4. # pvcreate /dev/sdb1
      This creates a new physical LVM volume on our new disk.

5. # vgextend VolGroup00 /dev/sdb1
      Add our new physical volume to the volume group: VolGroup00.

6. # pvscan
      You should see the new physical volume assigned to VolGroup00.

7. # lvextend -L+40G /dev/VolGroup00/LogVol00
      This increases the size of the logical volume our root partition resides in.

8. # resize2fs /dev/VolGroup00/LogVol00
      Resize2fs will just increase the file system to the max space available.

Other wise you have to restart the System then the changes will take effect..

Comments

Popular posts from this blog

Running web ssh client on port 443 /80 with nginx as reverse proxy

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

Setup VOD streaming server with nginx using RTMP on Ubuntu 18.04