[TESTED] Extend and mount new disk (/dev/sdb/) into your folder in dev/sda – Centos 7

My server has a partition and the disk size just 38GB, whereas I need about 20GB more for save my new files. With this condition I think have just two options between extend the partition before or add new disk and mount it into a folder within my partition before. Then I discuss with my friend which way is the best and the faster, finally I choose the second option which is add new disk (new partition, basically it will named as /dev/sdb/, /dev/sdc/, etc) and mount it into my specific folder, let say I will mount it into /opt/lampp/htdocs/aset.

So, how to extend new disk and mount it into our custom folder? here are the steps. This solution was tested successfully in my server Linux Centos 7.

# Check your which one is your new disk
# you can check that with this
sudo parted -l | grep Error

# or this one
# just make sure the free size still 100%
lsblk

# in my case I got /dev/sdb/
# so I started with this
pvcreate /dev/sdb

vgcreate diskaset /dev/sdb

lvclear

vgdisplay

# Chek these line!
# Alloc PE / Size       12799 / <50.00 GiB
# Free  PE / Size       0 / 0
#
# 12799 refers to Free PE or Alloc PE
lvcreate -l 12799 lv_diskaset diskaset

# Format the disk into XFS
# for "/disk/diskaset/" name it as you wish
sudo mkfs.xfs /dev/diskaset/
sudo mkfs.xfs /dev/diskaset/lv_diskaset

# Create folder for mount the disk
mkdir /opt/lampp/htdocs/aset/

# Mounting
mount /dev/diskaset/lv_diskaset /opt/lampp/htdocs/aset/

# Edit the "/etc/fstab" file for autostart when server startup
# Save
nano /etc/fstab/

# Add this line in the bottom
/dev/diskaset/lv_diskaset /opt/lampp/htdocs/aset        xfs     defaults        0 0

# Reboot your server
reboot

Finish, hope my solution above will help you sometime to extend and mount new disk into your custom folder for expanding storage in Linux Centos 7.