Add hard disk to VMware Linux VM

There are two easy steps to add a hard disk for a VMware Linux VM.
Assign a new hard disk in VMware vSphere
Configure the new hard disk in CentOS
This example assigns a new 5 GB hard disk as the /backup directory on CentOS 7
Assign hard disk in vSphere
In VMware vSphere, right click on the VM and select "Edit Settings..."
In the "New device:" section, select "SCSI Controller", and click the "OK" button. Note, there is a hard limit of 4 SCSI Controllers per VM.
Right click "Edit Settings..." again and select "New Hard Disk"
Input the byte size of the new hard disk (in this example, 5 GB). In the "Virtual Device Node" section, assign the new SCSI controller number. Click the "OK" button.

Configure new hard disk in CentOS
SSH into the CentOS VM and sudo to root
sudo su -List the block device to see the newly assigned vSphere hard disk.
lsblk
If you do not see the vSphere hard disk, force a rescan
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 doneFormat the disk partition. Get the device name from the previous lsblk output
fdisk /dev/sdb
See the screenshot for the options you should pick
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)
List the block device again to display the new disk partition /dev/sdb1
lsblk
Initialize the physical volume
pvcreate /dev/sdb1
To display the new physical volumepvs
Create the volume group
Note: vgBackup is just an name for this example. The volume group name can be whatever you wantvgcreate vgBackup /dev/sdb1
To display the volume groupvgsCreate the logical volume for the volume group
Note: lvBackup is just an name for this example. The logical volume name can be whatever you wantlvcreate -n lvBackup -l +100%FREE vgBackup
To display the logical volumelvs
Construct an XFS filesystem on the new logical volume
mkfs.xfs /dev/vgBackup/lvBackup
Edit the text file /etc/fstab and add the line below:
/dev/vgBackup/lvBakup /backup xfs defaults 1 2Mount a Unix directory to the logical volume
mkdir -p /backupmount /backupYou now have a new 5 GB hard disk assigned as the
/backupdirectory
To learn more about Unix Logical Volumes, go to official RedHat LVM docs
