This is for my own reference. if this will help you, I’m glad to help.
Login to vSphere then click to the Virtual Machine that you are planning to Add/Remove the hard drive.
Click add/remove hard drive.
Power on the virtual machine and the system will have error on first boot when you remove then add a new hard drive.
login using root password, please do not press the Control+D.
Edit the /etc/fstab
“nano /etc/fstab”
commend the UUID of the remove HDD
Then “fdisk -l” command will determine the drives that is mounted and not yet mounted. Once determined you may used below command to partation the disk.
Example:
fdisk /dev/sdb
press n (this is to create partition)
press w (to write the configuration)
To format the drive using ext4
mkfs.ext4 /dev/sdb
Then how to get the UUID of the drive
blkid /dev/sdb
root@localhost:/mnt/data0# blkid /dev/sdb
/dev/sdb: UUID=”1fe36964-96c5-48a4-b5b7-415360b12b89″ TYPE=”ext4″
update the /etc/fstab
# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=c42fc13b-fb5e-472e-afee-1a936085b588 / ext4 errors=remoun$
# /mnt/data0 was on /dev/sdb1 during installation
UUID=1fe36964-96c5-48a4-b5b7-415360b12b89 /mnt/data0 ext4 defaults
# /var was on /dev/sda2 during installation
UUID=6ba94173-99b5-453b-9fcb-63d541df4e8e /var ext4 defaults $
# swap was on /dev/sda1 during installation
UUID=9809923b-5753-4da4-b4e9-badd936edf2e none swap sw $
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0