The original partition scheme
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/cl-root xfs 50G 3.0G 48G 6% /
/dev/sda1 xfs 1014M 179M 836M 18% /boot
/dev/mapper/cl-home xfs 965G 42G 924G 5% /home
Stop the service that might be using the partition that we are going to change
# systemctl stop elasticsearch
Rename the original directory to other name
# mv /var/lib/elasticsearch /var/lib/elasticsearch-old
Create a new directory to replace the one we already renamed above
# mkdir /var/lib/elasticsearch
Unmount /home
# umount /home
Check the name of volume group and logical volume
# lvs
Rename the logical volume to the one we desired. This is totally optional. You can use -t flag to test out the renaming process before proceeding
# lvrename -t cl home elasticsearch
# lvrename cl home elasticsearch
Change /etc/fstab to reflect on the new logical volume name and mount point. Test it out without the -i option, before permanently make the change using the -i option
# sed 's/cl-home/cl-elasticsearch/g;s/\/home/\/var\/lib\/elasticsearch/g' /etc/fstab
# sed -i 's/cl-home/cl-elasticsearch/g;s/\/home/\/var\/lib\/elasticsearch/g' /etc/fstab
Mount it
# mount -a
Check to see if your new directory and logical volume mounted properly
# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/cl-root xfs 50G 3.0G 48G 6% /
/dev/sda1 xfs 1014M 179M 836M 18% /boot
/dev/mapper/cl-elasticsearch xfs 965G 42G 924G 5% /var/lib/elasticsearch
Move the content of /var/lib/elasticsearch to /home
# mv /var/lib/elasticsearch/* /home
Move the content of /var/lib/elasticsearch-old to /var/lib/elasticsearch
# mv /var/lib/elasticsearch-old/* /var/lib/elasticsearch
Remove /var/lib/elasticsearch-old
# rmdir /var/lib/elasticsearch-old
Set proper permission for /var/lib/elasticsearch
# chmod 750 -R /var/lib/elasticsearch
# chown -R elasticsearch.elasticsearch /var/lib/elasticsearch
Start your service
# systemctl start elasticsearch
Done.