Skip to content

Instantly share code, notes, and snippets.

@runchranda
Last active November 25, 2020 04:31
Show Gist options
  • Select an option

  • Save runchranda/177f83f279bce172844d5405e8aee11b to your computer and use it in GitHub Desktop.

Select an option

Save runchranda/177f83f279bce172844d5405e8aee11b to your computer and use it in GitHub Desktop.
Change mount location from /home to /var/lib/elasticsearch for Elasticsearch

Elasticsearch Directory Move Into New Partition (Example /home)
***Login as root or any user that NOT using /home
***Stop elasticsearch service
***Make sure SELINUX is permissive mode. View file /etc/selinux/config

Step 1 - Copy /home Contents

To backup the contents of /home, do the following: mkdir /newhome cp -rfp /home/* /newhome

Make sure your / is still enough df -h Once that is finished at your back at the prompt, you can proceed to step 2.

Step 2 - Unmount the /home directory

umount -fl /home

Step 3 - Remove the /home

rmdir /home

Step 4 - rename /newhome to /home directory

mv /newhome /home

Step 5 - Change the entry from /etc/fstab

Using your preferred text editor, ensure you open /etc/fstab and change of the line for /dev/mapper/cl-home (mount point at the beginning of line) Change only word /home to /var/lib/elasticsearch

Step 6 - rename /var/lib/elasticsearch to /var/lib/elasticsearch-old directory

mv /var/lib/elasticsearch /var/lib/elasticsearch-old

Step 7 - mount the /var/lib/elasticsearch directory

mkdir /var/lib/elasticsearch
chown elasticsearch:elasticsearch /var/lib/elasticsearch
mount /var/lib/elasticsearch

Step 8 - Copy /var/lib/elasticsearch-old Contents

To copy the contents of /var/lib/elasticsearch-old, do the following: chown elasticsearch:elasticsearch /var/lib/elasticsearch cp -rfp /var/lib/elasticsearch-old/* /var/lib/elasticsearch

Step 9 - check the disk space

df -h

Step 10 - Don't miss this!

Run the following command to sync systemd up with the changes. dracut --regenerate-all --force

This rescue option is useful if you have problems after adding new hardware. You can use the rescue option to regenerate the initramfs for all boot entries using the above command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment